##// END OF EJS Templates
Preserve uploaded files when on news....
Jean-Philippe Lang -
r8822:707ce0beeff8
parent child
Show More
@@ -69,6 +69,7 class NewsController < ApplicationController
69 69 def create
70 70 @news = News.new(:project => @project, :author => User.current)
71 71 @news.attributes = params[:news]
72 @news.save_attachments(params[:attachments])
72 73 if @news.save
73 74 attachments = Attachment.attach_files(@news, params[:attachments])
74 75 render_attachment_warning_if_needed(@news)
@@ -83,6 +84,7 class NewsController < ApplicationController
83 84 end
84 85
85 86 def update
87 @news.save_attachments(params[:attachments])
86 88 if @news.update_attributes(params[:news])
87 89 attachments = Attachment.attach_files(@news, params[:attachments])
88 90 render_attachment_warning_if_needed(@news)
@@ -3,7 +3,7
3 3 <p><%= f.text_field :title, :required => true, :size => 60 %></p>
4 4 <p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
5 5 <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
6 <p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %></p>
6 <p id="attachments_form"><%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
7 7 </div>
8 8
9 9 <%= wikitoolbar_for 'news_description' %>
General Comments 0
You need to be logged in to leave comments. Login now