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:
1 parent
4a524ff911
commit
6446c312be
16 files changed
+43
-2
No files matched your search
@@ -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
|
||||
|
||||
@@ -32,6 +32,7 @@ class Permission < ActiveRecord::Base
|
||||
1300 => :label_attachment_plural,
|
||||
1400 => :label_repository,
|
||||
1500 => :label_time_tracking,
|
||||
1700 => :label_wiki_page_plural,
|
||||
2000 => :label_board_plural
|
||||
}.freeze
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div class="contextual">
|
||||
<%= link_to(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') if @content.version == @page.content.version %>
|
||||
<%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
|
||||
<%= link_to(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %>
|
||||
<%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %>
|
||||
<%= link_to(l(:label_page_index), {:action => 'special', :page => 'Page_index'}, :class => 'icon icon-index') %>
|
||||
|
||||
Reference in new issue
Block a user