From 09e31c6fb9d76c6ae24f0defce674205f1e7412f Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 13 Aug 2013 10:15:20 +0200 Subject: [PATCH] SONAR-4568 On a boolean rule parameter, this is not possible to set back the parameter value to 'Default' --- .../app/controllers/rules_configuration_controller.rb | 5 +++-- .../app/views/rules_configuration/_rule_param.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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 1450440a5b2..b0b9dab8659 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 @@ -307,7 +307,7 @@ class RulesConfigurationController < ApplicationController def update_param verify_post_request access_denied unless has_role?(:profileadmin) - require_parameters :profile_id, :param_id, :active_rule_id, :value + require_parameters :profile_id, :param_id, :active_rule_id profile = Profile.find(params[:profile_id].to_i) rule_param = RulesParameter.find(params[:param_id].to_i) active_rule = ActiveRule.find(params[:active_rule_id].to_i) @@ -327,7 +327,8 @@ class RulesConfigurationController < ApplicationController active_param = nil java_facade.ruleParamChanged(profile.id, active_rule.id, rule_param.name, old_value, nil, current_user.name) end - # let's reload the active rule + + # let's reload the active rule active_rule = ActiveRule.find(active_rule.id) render :partial => 'rule', :locals => {:profile => profile, :rule => active_rule.rule, :active_rule => active_rule} end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb index 34afac5ad91..76037b191c3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_param.html.erb @@ -8,7 +8,7 @@ <%= parameter.name -%> -
/rules_configuration/update_param/<%=active_param_id-%>?active_rule_id=<%=active_rule_id-%>¶m_id=<%=parameter.id-%>&profile_id=<%=profile.id-%>', type:'post',beforeSend: function(request){$j('#param_loading_<%=parameter.id-%>').show();$j('#error_<%=parameter.id-%>').hide();}, data: $j(this).serialize(), success: function(htmlSuccess){$j('#rule_<%=rule.id-%>').replaceWith(htmlSuccess);}, @@ -23,7 +23,7 @@ <%= param_value_input(parameter, param_value, :disabled => read_only) -%> <% unless read_only %> - <%= submit_tag message('update_verb') %> + <%= submit_tag(message('update_verb'), :id => 'submit_' + parameter.id.to_s) %> <% if active_parameter and active_parameter.errors.size>0 %> <%= active_parameter.errors.on 'value' %> -- 2.39.5