From: Godin Date: Tue, 21 Dec 2010 20:49:31 +0000 (+0000) Subject: SONAR-2048: Move inheritance settings to separate tab X-Git-Tag: 2.6~261 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=748efe41d5d2a9f1f99374c9949b49a2c4c88a4d;p=sonarqube.git SONAR-2048: Move inheritance settings to separate tab --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index dbc44d54107..d0bea432189 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -20,7 +20,8 @@ class ProfilesController < ApplicationController SECTION=Navigation::SECTION_CONFIGURATION - verify :method => :post, :only => ['create', 'delete', 'copy', 'set_as_default', 'restore', 'set_projects', 'rename'], :redirect_to => { :action => 'index' } + # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) + verify :method => :post, :only => ['create', 'delete', 'copy', 'set_as_default', 'restore', 'set_projects', 'rename', 'change_parent'], :redirect_to => { :action => 'index' } # the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039 before_filter :admin_required, :except => [ 'index', 'show', 'projects', 'permalinks', 'export', 'backup', 'inheritance' ] @@ -195,6 +196,23 @@ class ProfilesController < ApplicationController end + # + # + # POST /profiles/change_parent?id=&parent_name= + # + # + def change_parent + id = params[:id].to_i + parent_name = params[:parent_name] + if parent_name.blank? + java_facade.changeParentProfile(id, nil) + else + java_facade.changeParentProfile(id, parent_name) + end + redirect_to :action => 'inheritance', :id => id + end + + # # # GET /profiles/permalinks?id= diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb index 0dd68d535ff..163b5e29de1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb @@ -29,7 +29,7 @@ class RulesConfigurationController < ApplicationController RULE_PRIORITIES = Sonar::RulePriority.as_options.reverse # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) - verify :method => :post, :only => ['activate_rule', 'update_param', 'bulk_edit', 'create', 'update', 'delete', 'change_parent', 'revert_rule'], :redirect_to => { :action => 'index' } + verify :method => :post, :only => ['activate_rule', 'update_param', 'bulk_edit', 'create', 'update', 'delete', 'revert_rule'], :redirect_to => { :action => 'index' } before_filter :admin_required, :except => [ 'index', 'export' ] @@ -73,23 +73,6 @@ class RulesConfigurationController < ApplicationController end end - - - # - # - # POST /rules_configuration/change_parent?id=&parent_name= - # - # - def change_parent - id = params[:id].to_i - parent_name = params[:parent_name] - if parent_name.blank? - java_facade.changeParentProfile(id, nil) - else - java_facade.changeParentProfile(id, parent_name) - end - redirect_to :action => 'index', :id => params[:id] - end # diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb index 4bf37458890..dcd2c770ce3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/inheritance.html.erb @@ -5,7 +5,7 @@ <% if !@profile.provided? %> <% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %> - <%= hidden_field_tag "id", @id %> + <%= hidden_field_tag "id", @profile.id %> Parent profile: <%= select_tag "parent_name", options_for_select(@select_parent, @profile.parent_name), :disabled => !is_admin? %> <%= submit_tag "Change", :id => 'submit_parent', :disabled => !is_admin? %> <% end %>