From e8468b51cc7c0725e1f59d4f2f2c828ffcd080ce Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 13 Oct 2010 17:13:50 +0000 Subject: 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 --- app/controllers/wiki_controller.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'app/controllers') 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]) -- cgit v1.2.3