summaryrefslogtreecommitdiffstats
path: root/app/controllers/wiki_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-09 17:05:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-09 17:05:38 +0000
commitb4d9ca8875898500ca198bff501dfc7d1c28bd71 (patch)
tree8d9ebcf80cd56b427211b6b769514ab8d66f33a2 /app/controllers/wiki_controller.rb
parentf6fe15716e4714c5f6d4d88149927b7dfa5c6fce (diff)
downloadredmine-b4d9ca8875898500ca198bff501dfc7d1c28bd71.tar.gz
redmine-b4d9ca8875898500ca198bff501dfc7d1c28bd71.zip
Added the ability to rename wiki pages (specific permission required).
Existing links that point to the old page are preserved and automatically redirected to the new page (this behaviour can be disabled when renaming the page). git-svn-id: http://redmine.rubyforge.org/svn/trunk@720 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/wiki_controller.rb')
-rw-r--r--app/controllers/wiki_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index e9212a1c7..95f792c5e 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -75,6 +75,18 @@ class WikiController < ApplicationController
flash[:error] = l(:notice_locking_conflict)
end
+ # rename a page
+ def rename
+ @page = @wiki.find_page(params[:page])
+ @page.redirect_existing_links = true
+ # used to display the *original* title if some AR validation errors occur
+ @original_title = @page.pretty_title
+ if request.post? && @page.update_attributes(params[:wiki_page])
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to :action => 'index', :id => @project, :page => @page.title
+ end
+ end
+
# show page history
def history
@page = @wiki.find_page(params[:page])