@@ -69,6 +69,7 class NewsController < ApplicationController | |||||
69 | def create |
|
69 | def create | |
70 | @news = News.new(:project => @project, :author => User.current) |
|
70 | @news = News.new(:project => @project, :author => User.current) | |
71 | @news.attributes = params[:news] |
|
71 | @news.attributes = params[:news] | |
|
72 | @news.save_attachments(params[:attachments]) | |||
72 | if @news.save |
|
73 | if @news.save | |
73 | attachments = Attachment.attach_files(@news, params[:attachments]) |
|
74 | attachments = Attachment.attach_files(@news, params[:attachments]) | |
74 | render_attachment_warning_if_needed(@news) |
|
75 | render_attachment_warning_if_needed(@news) | |
@@ -83,6 +84,7 class NewsController < ApplicationController | |||||
83 | end |
|
84 | end | |
84 |
|
85 | |||
85 | def update |
|
86 | def update | |
|
87 | @news.save_attachments(params[:attachments]) | |||
86 | if @news.update_attributes(params[:news]) |
|
88 | if @news.update_attributes(params[:news]) | |
87 | attachments = Attachment.attach_files(@news, params[:attachments]) |
|
89 | attachments = Attachment.attach_files(@news, params[:attachments]) | |
88 | render_attachment_warning_if_needed(@news) |
|
90 | render_attachment_warning_if_needed(@news) |
@@ -3,7 +3,7 | |||||
3 | <p><%= f.text_field :title, :required => true, :size => 60 %></p> |
|
3 | <p><%= f.text_field :title, :required => true, :size => 60 %></p> | |
4 | <p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p> |
|
4 | <p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p> | |
5 | <p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p> |
|
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 | </div> |
|
7 | </div> | |
8 |
|
8 | |||
9 | <%= wikitoolbar_for 'news_description' %> |
|
9 | <%= wikitoolbar_for 'news_description' %> |
General Comments 0
You need to be logged in to leave comments.
Login now