From 88c258902a4e33017028bc28207f4b4def3e168e Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Wed, 25 Jan 2012 19:01:07 +0100 Subject: SONAR-2124 Show difference when rules in derived profiles are changed + link to the rules that has been overriden + UI improvements --- .../main/resources/org/sonar/l10n/core.properties | 3 ++ .../controllers/rules_configuration_controller.rb | 7 ++-- .../app/views/rules_configuration/_rule.html.erb | 40 +++++++++++++++------- .../views/rules_configuration/_rule_param.html.erb | 19 ++++++++-- .../app/views/rules_configuration/index.html.erb | 2 +- 5 files changed, 53 insertions(+), 18 deletions(-) diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 65ea811bc42..5d321b41a82 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -992,6 +992,9 @@ rules_configuration.add_note=Add note rules_configuration.confirm_delete_note=Do you really want to delete this note? rules_configuration.rule_identification=Identification rules_configuration.rule_parameters=Parameters +rules_configuration.rule_inherited_from_profile_x=Rule inherited from profile "{0}" +rules_configuration.rule_overriding_from_profile_x=Rule overrides parent definition from profile "{0}" +rules_configuration.original_value=Original value #------------------------------------------------------------------------------ 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 91ad6b65236..c1c298abc1f 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 @@ -137,7 +137,7 @@ class RulesConfigurationController < ApplicationController is_admin=true # security has already been checked by controller filters render :update do |page| - page.replace_html("rule_#{rule.id}", :partial => 'rule', :object => rule, :locals => {:profile => profile, :active_rule => active_rule, :is_admin => is_admin}) + page.replace_html("rule_#{rule.id}", :partial => 'rule', :object => rule, :locals => {:profile => profile, :rule => rule, :active_rule => active_rule, :is_admin => is_admin}) page.assign('localModifications', true) end end @@ -310,8 +310,9 @@ class RulesConfigurationController < ApplicationController java_facade.ruleParamChanged(profile.id, active_rule.id, rule_param.name, old_value, nil, current_user.name) end end - render :partial => 'rule_param', :object => nil, - :locals => {:parameter => rule_param, :active_parameter => active_param, :profile => profile, :active_rule => active_rule, :is_admin => is_admin } + # 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, :is_admin => is_admin } end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb index a56225876bb..a2e6f2b29f2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule.html.erb @@ -34,7 +34,8 @@ page.toggle "desc_#{rule.id}" end %> -