From a997da1cf0e1890c7cb73c030d7af31bc8fd39d8 Mon Sep 17 00:00:00 2001 From: stephenbroyer Date: Wed, 16 Oct 2013 15:40:57 +0200 Subject: SONAR-4760 Use modal windows in Manual Rules pages (delete rule with link_to_action) --- .../WEB-INF/app/controllers/manual_rules_controller.rb | 4 ++-- .../webapp/WEB-INF/app/views/manual_rules/index.html.erb | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'sonar-server/src') diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb index 29f2ab1b8bd..2883246c6bb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/manual_rules_controller.rb @@ -20,7 +20,6 @@ class ManualRulesController < ApplicationController before_filter :admin_required - verify :method => :delete, :only => [:delete], :redirect_to => {:action => :index} SECTION=Navigation::SECTION_CONFIGURATION @@ -81,6 +80,7 @@ class ManualRulesController < ApplicationController end def delete + verify_post_request access_denied unless is_admin? rule=Rule.manual_rule(params['id'].to_i) bad_request('Missing rule id') unless rule @@ -90,4 +90,4 @@ class ManualRulesController < ApplicationController end redirect_to :action => 'index' end -end \ No newline at end of file +end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb index 1c7ad51f159..cd7a063581f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/manual_rules/index.html.erb @@ -34,8 +34,16 @@ Edit -   - <%= link_to 'Delete', {:action => 'delete', :id => rule.id}, {:confirm => message('are_you_sure'), :id => "delete_#{u(rule.key)}", :class => 'link-action link-red', :method => 'delete'} %> + + + <%= link_to_action message('deleteNew'), "#{ApplicationController.root_context}/manual_rules/delete/#{rule.id}", + :class => 'link-action link-red', + :id => "delete_#{rule.id}", + :confirm_button => message('delete'), + :confirm_title => 'Delete rule '+rule.name, + :confirm_msg => 'Warning : are you sure to delete this rule?', + :confirm_msg_params => [rule.name] + -%> <% end %> -- cgit v1.2.3