diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-02 19:26:03 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-02 19:26:03 +0000 |
commit | 0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd (patch) | |
tree | d2e93da10c1c871b04783dccfd56f92ec0ef502a /app/controllers/wiki_controller.rb | |
parent | 81d617cd5b97a811503282a5a5d056fa5b3adc0f (diff) | |
download | redmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.tar.gz redmine-0fd7e2d696cf2d94da8b4cbcdb8fa4b36eb395fd.zip |
Refactor: Moved ApplicationController#attach_files to the Attachment model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3523 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r-- | app/controllers/wiki_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index fb472636b..e0e159a00 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -76,7 +76,8 @@ class WikiController < ApplicationController @content.version = @page.content.version else if !@page.new_record? && @content.text == params[:content][:text] - attach_files(@page, params[:attachments]) + attachments = Attachment.attach_files(@page, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] # don't save if text wasn't changed redirect_to :action => 'index', :id => @project, :page => @page.title return @@ -87,7 +88,8 @@ class WikiController < ApplicationController @content.author = User.current # if page is new @page.save will also save content, but not if page isn't a new record if (@page.new_record? ? @page.save : @content.save) - attach_files(@page, params[:attachments]) + attachments = Attachment.attach_files(@page, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) redirect_to :action => 'index', :id => @project, :page => @page.title end @@ -211,7 +213,8 @@ class WikiController < ApplicationController def add_attachment return render_403 unless editable? - attach_files(@page, params[:attachments]) + attachments = Attachment.attach_files(@page, params[:attachments]) + flash[:warning] = attachments[:flash] if attachments[:flash] redirect_to :action => 'index', :page => @page.title end |