summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/wiki_controller.rb12
-rw-r--r--app/models/permission.rb1
-rw-r--r--app/views/wiki/show.rhtml1
3 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 9e750b3a6..f68b71ecc 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -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
diff --git a/app/models/permission.rb b/app/models/permission.rb
index f78118d86..bea670c4c 100644
--- a/app/models/permission.rb
+++ b/app/models/permission.rb
@@ -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
diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml
index a65b1a61e..c2deba02b 100644
--- a/app/views/wiki/show.rhtml
+++ b/app/views/wiki/show.rhtml
@@ -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') %>