@@ -68,16 +68,14 class NewsController < ApplicationController | |||
|
68 | 68 | |
|
69 | 69 | def create |
|
70 | 70 | @news = News.new(:project => @project, :author => User.current) |
|
71 | if request.post? | |
|
72 | @news.attributes = params[:news] | |
|
73 | if @news.save | |
|
74 | attachments = Attachment.attach_files(@news, params[:attachments]) | |
|
75 | render_attachment_warning_if_needed(@news) | |
|
76 | flash[:notice] = l(:notice_successful_create) | |
|
77 | redirect_to :controller => 'news', :action => 'index', :project_id => @project | |
|
78 | else | |
|
79 | render :action => 'new' | |
|
80 | end | |
|
71 | @news.attributes = params[:news] | |
|
72 | if @news.save | |
|
73 | attachments = Attachment.attach_files(@news, params[:attachments]) | |
|
74 | render_attachment_warning_if_needed(@news) | |
|
75 | flash[:notice] = l(:notice_successful_create) | |
|
76 | redirect_to :controller => 'news', :action => 'index', :project_id => @project | |
|
77 | else | |
|
78 | render :action => 'new' | |
|
81 | 79 | end |
|
82 | 80 | end |
|
83 | 81 | |
@@ -85,7 +83,7 class NewsController < ApplicationController | |||
|
85 | 83 | end |
|
86 | 84 | |
|
87 | 85 | def update |
|
88 |
if |
|
|
86 | if @news.update_attributes(params[:news]) | |
|
89 | 87 | attachments = Attachment.attach_files(@news, params[:attachments]) |
|
90 | 88 | render_attachment_warning_if_needed(@news) |
|
91 | 89 | flash[:notice] = l(:notice_successful_update) |
General Comments 0
You need to be logged in to leave comments.
Login now