summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-10-13 17:13:50 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-10-13 17:13:50 +0000
commite8468b51cc7c0725e1f59d4f2f2c828ffcd080ce (patch)
tree8b8e18f7decbf5952ecdc5b213f43be1df753983 /app/controllers
parent718816c5d4b0c45ce1def155c9f517fb5ac91e35 (diff)
downloadredmine-e8468b51cc7c0725e1f59d4f2f2c828ffcd080ce.tar.gz
redmine-e8468b51cc7c0725e1f59d4f2f2c828ffcd080ce.zip
Refactor: extract method in WikiController#special to create a new #export method
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4251 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/wiki_controller.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 55194e048..10890495f 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -181,16 +181,9 @@ class WikiController < ApplicationController
:order => 'title'
@pages_by_date = @pages.group_by {|p| p.updated_on.to_date}
@pages_by_parent_id = @pages.group_by(&:parent_id)
- # export wiki to a single html file
when 'export'
- if User.current.allowed_to?(:export_wiki_pages, @project)
- @pages = @wiki.pages.find :all, :order => 'title'
- export = render_to_string :action => 'export_multiple', :layout => false
- send_data(export, :type => 'text/html', :filename => "wiki.html")
- else
- redirect_to :action => 'index', :id => @project, :page => nil
- end
- return
+ redirect_to :action => 'export', :id => @project # Compatibility stub while refactoring
+ return
else
# requested special page doesn't exist, redirect to default page
redirect_to :action => 'index', :id => @project, :page => nil
@@ -198,6 +191,17 @@ class WikiController < ApplicationController
end
render :action => "special_#{page_title}"
end
+
+ # Export wiki to a single html file
+ def export
+ if User.current.allowed_to?(:export_wiki_pages, @project)
+ @pages = @wiki.pages.find :all, :order => 'title'
+ export = render_to_string :action => 'export_multiple', :layout => false
+ send_data(export, :type => 'text/html', :filename => "wiki.html")
+ else
+ redirect_to :action => 'index', :id => @project, :page => nil
+ end
+ end
def preview
page = @wiki.find_page(params[:page])