From c259ada6e1c46b0c7c21bd11bc1a0659da1ede9e Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 21 Oct 2010 16:07:28 +0000 Subject: [PATCH 01/30] Refactor: rename WikiController#index to #show, it's a single resource action git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4266 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 18 ++++++++-------- app/helpers/application_helper.rb | 4 ++-- app/views/wiki/_sidebar.rhtml | 2 +- app/views/wiki/annotate.rhtml | 4 ++-- app/views/wiki/date_index.html.erb | 6 +++--- app/views/wiki/destroy.rhtml | 2 +- app/views/wiki/diff.rhtml | 4 ++-- app/views/wiki/history.rhtml | 2 +- app/views/wiki/page_index.html.erb | 4 ++-- app/views/wiki/show.rhtml | 6 +++--- config/routes.rb | 2 +- lib/redmine.rb | 4 ++-- test/functional/wiki_controller_test.rb | 28 ++++++++++++------------- test/integration/routing_test.rb | 4 ++-- 14 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 75902d54..95e1943e 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -22,14 +22,14 @@ class WikiController < ApplicationController before_filter :find_wiki, :authorize before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] - verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :index } + verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :show } helper :attachments include AttachmentsHelper helper :watchers - + # display a page (in editing mode if it doesn't exist) - def index + def show page_title = params[:page] @page = @wiki.find_or_new_page(page_title) if @page.new_record? @@ -79,7 +79,7 @@ class WikiController < ApplicationController attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) # don't save if text wasn't changed - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title return end #@content.text = params[:content][:text] @@ -91,7 +91,7 @@ class WikiController < ApplicationController attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page}) - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end end rescue ActiveRecord::StaleObjectError @@ -107,13 +107,13 @@ class WikiController < ApplicationController @original_title = @page.pretty_title if request.post? && @page.update_attributes(params[:wiki_page]) flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end end def protect @page.update_attribute :protected, params[:protected] - redirect_to :action => 'index', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :page => @page.title end # show page history @@ -176,7 +176,7 @@ class WikiController < ApplicationController export = render_to_string :action => 'export_multiple', :layout => false send_data(export, :type => 'text/html', :filename => "wiki.html") else - redirect_to :action => 'index', :project_id => @project, :page => nil + redirect_to :action => 'show', :project_id => @project, :page => nil end end @@ -204,7 +204,7 @@ class WikiController < ApplicationController return render_403 unless editable? attachments = Attachment.attach_files(@page, params[:attachments]) render_attachment_warning_if_needed(@page) - redirect_to :action => 'index', :page => @page.title + redirect_to :action => 'show', :page => @page.title end private diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2ac301d5..fb4b84d7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -182,7 +182,7 @@ module ApplicationHelper content << "