From 70bf0706b2f7933f72cbd4daab8e43b0ac9de4e9 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 26 Oct 2010 15:59:20 +0000 Subject: Refactor: convert WikiController#destroy to use HTTP DELETE git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4295 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 5 +++-- app/views/wiki/destroy.rhtml | 2 +- app/views/wiki/show.rhtml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index c7b866239..4f15d35a0 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -36,7 +36,7 @@ class WikiController < ApplicationController before_filter :find_wiki, :authorize before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] - verify :method => :post, :only => [:destroy, :protect], :redirect_to => { :action => :show } + verify :method => :post, :only => [:protect], :redirect_to => { :action => :show } helper :attachments include AttachmentsHelper @@ -172,7 +172,8 @@ class WikiController < ApplicationController @annotate = @page.annotate(params[:version]) render_404 unless @annotate end - + + verify :method => :delete, :only => [:destroy], :redirect_to => { :action => :show } # Removes a wiki page and its history # Children can be either set as root pages, removed or reassigned to another parent page def destroy diff --git a/app/views/wiki/destroy.rhtml b/app/views/wiki/destroy.rhtml index 83c81fd5c..99f470320 100644 --- a/app/views/wiki/destroy.rhtml +++ b/app/views/wiki/destroy.rhtml @@ -1,6 +1,6 @@

<%=h @page.pretty_title %>

-<% form_tag({}) do %> +<% form_tag({}, :method => :delete) do %>

<%= l(:text_wiki_page_destroy_question, :descendants => @descendants_count) %>


diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index f8675608e..d8bc8c55e 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -5,7 +5,7 @@ <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :page => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :page => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') 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_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> <% end %> <%= link_to_if_authorized(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> -- cgit v1.2.3