From e9efa5b9814bbeddd9956b8478ed26af02b0eeca Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 27 Oct 2010 16:27:06 +0000 Subject: [PATCH] Refactor: use :id instead of :page when linking to Wiki Pages git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4296 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 22 +++---- app/helpers/application_helper.rb | 4 +- app/models/mailer.rb | 10 +-- app/models/wiki_content.rb | 2 +- app/models/wiki_page.rb | 4 +- .../mailer/wiki_content_added.text.html.rhtml | 2 +- .../wiki_content_added.text.plain.rhtml | 2 +- .../wiki_content_updated.text.html.rhtml | 2 +- .../wiki_content_updated.text.plain.rhtml | 2 +- app/views/projects/settings/_versions.rhtml | 2 +- app/views/versions/show.rhtml | 2 +- app/views/wiki/_sidebar.rhtml | 2 +- app/views/wiki/annotate.rhtml | 8 +-- app/views/wiki/date_index.html.erb | 2 +- app/views/wiki/destroy.rhtml | 2 +- app/views/wiki/diff.rhtml | 6 +- app/views/wiki/edit.rhtml | 4 +- app/views/wiki/history.rhtml | 4 +- app/views/wiki/show.rhtml | 30 ++++----- config/locales/bg.yml | 8 +-- config/locales/bs.yml | 8 +-- config/locales/ca.yml | 8 +-- config/locales/cs.yml | 8 +-- config/locales/da.yml | 8 +-- config/locales/de.yml | 8 +-- config/locales/el.yml | 8 +-- config/locales/en-GB.yml | 8 +-- config/locales/en.yml | 8 +-- config/locales/es.yml | 8 +-- config/locales/eu.yml | 8 +-- config/locales/fi.yml | 8 +-- config/locales/fr.yml | 8 +-- config/locales/gl.yml | 8 +-- config/locales/he.yml | 8 +-- config/locales/hr.yml | 8 +-- config/locales/hu.yml | 8 +-- config/locales/id.yml | 8 +-- config/locales/it.yml | 8 +-- config/locales/ja.yml | 8 +-- config/locales/ko.yml | 8 +-- config/locales/lt.yml | 8 +-- config/locales/lv.yml | 8 +-- config/locales/mk.yml | 8 +-- config/locales/mn.yml | 8 +-- config/locales/nl.yml | 8 +-- config/locales/no.yml | 8 +-- config/locales/pl.yml | 8 +-- config/locales/pt-BR.yml | 8 +-- config/locales/pt.yml | 8 +-- config/locales/ro.yml | 8 +-- config/locales/ru.yml | 8 +-- config/locales/sk.yml | 8 +-- config/locales/sl.yml | 8 +-- config/locales/sr-YU.yml | 8 +-- config/locales/sr.yml | 8 +-- config/locales/sv.yml | 8 +-- config/locales/th.yml | 8 +-- config/locales/tr.yml | 8 +-- config/locales/uk.yml | 8 +-- config/locales/vi.yml | 8 +-- config/locales/zh-TW.yml | 8 +-- config/locales/zh.yml | 8 +-- config/routes.rb | 18 +++--- lib/redmine.rb | 2 +- test/functional/wiki_controller_test.rb | 62 +++++++++---------- test/integration/routing_test.rb | 24 +++---- 66 files changed, 281 insertions(+), 281 deletions(-) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 4f15d35a0..39786341b 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -49,7 +49,7 @@ class WikiController < ApplicationController # display a page (in editing mode if it doesn't exist) def show - page_title = params[:page] + page_title = params[:id] @page = @wiki.find_or_new_page(page_title) if @page.new_record? if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? @@ -82,7 +82,7 @@ class WikiController < ApplicationController # edit an existing page or a new one def edit - @page = @wiki.find_or_new_page(params[:page]) + @page = @wiki.find_or_new_page(params[:id]) return render_403 unless editable? @page.content = WikiContent.new(:page => @page) if @page.new_record? @@ -101,7 +101,7 @@ class WikiController < ApplicationController verify :method => :post, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } # Creates a new page or updates an existing one def update - @page = @wiki.find_or_new_page(params[:page]) + @page = @wiki.find_or_new_page(params[:id]) return render_403 unless editable? @page.content = WikiContent.new(:page => @page) if @page.new_record? @@ -114,7 +114,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 => 'show', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :id => @page.title return end @content.attributes = params[:content] @@ -124,7 +124,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 => 'show', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :id => @page.title end rescue ActiveRecord::StaleObjectError @@ -140,13 +140,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 => 'show', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :id => @page.title end end def protect @page.update_attribute :protected, params[:protected] - redirect_to :action => 'show', :project_id => @project, :page => @page.title + redirect_to :action => 'show', :project_id => @project, :id => @page.title end # show page history @@ -210,7 +210,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 => 'show', :project_id => @project, :page => nil + redirect_to :action => 'show', :project_id => @project, :id => nil end end @@ -219,7 +219,7 @@ class WikiController < ApplicationController end def preview - page = @wiki.find_page(params[:page]) + page = @wiki.find_page(params[:id]) # page is nil when previewing a new page return render_403 unless page.nil? || editable?(page) if page @@ -234,7 +234,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 => 'show', :page => @page.title + redirect_to :action => 'show', :id => @page.title end private @@ -249,7 +249,7 @@ private # Finds the requested page and returns a 404 error if it doesn't exist def find_existing_page - @page = @wiki.find_page(params[:page]) + @page = @wiki.find_page(params[:id]) render_404 if @page.nil? end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 38d43e5b8..12f4b6e5e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -177,7 +177,7 @@ module ApplicationHelper content << "