Added the ability to destroy wiki pages (content and its history are deleted from the database).

This permission has to be explicitly given (Roles & Permissions -> Wiki pages/Delete).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@540 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-05-25 16:44:50 +00:00
parent 4a524ff911
commit 6446c312be
16 changed files with 43 additions and 2 deletions
+11 -1
View File
@@ -18,7 +18,10 @@
class WikiController < ApplicationController
layout 'base'
before_filter :find_wiki, :check_project_privacy, :except => [:preview]
before_filter :authorize, :only => :destroy
verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }
# display a page (in editing mode if it doesn't exist)
def index
page_title = params[:page]
@@ -72,6 +75,13 @@ class WikiController < ApplicationController
:select => "id, author_id, comments, updated_on, version",
:order => 'version DESC'
end
# remove a wiki page and its history
def destroy
@page = @wiki.find_page(params[:page])
@page.destroy if @page
redirect_to :action => 'special', :id => @project, :page => 'Page_index'
end
# display special pages
def special