summaryrefslogtreecommitdiffstats
path: root/app/controllers/wiki_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-10-27 16:27:06 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-10-27 16:27:06 +0000
commite9efa5b9814bbeddd9956b8478ed26af02b0eeca (patch)
treed2b8c54194c7410edd114483d3645d9945aff17a /app/controllers/wiki_controller.rb
parent70bf0706b2f7933f72cbd4daab8e43b0ac9de4e9 (diff)
downloadredmine-e9efa5b9814bbeddd9956b8478ed26af02b0eeca.tar.gz
redmine-e9efa5b9814bbeddd9956b8478ed26af02b0eeca.zip
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
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r--app/controllers/wiki_controller.rb22
1 files changed, 11 insertions, 11 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