From c073a325c80ef5d4c0d805b2545dd6be40b1892e Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Fri, 27 May 2011 04:22:42 +0400 Subject: [PATCH] SONAR-1922 Improve UI for profile changelog * Reorder columns * Use bold instead of italic to express parameter changes * Show severity icons * Lowercase action text and simplify code --- .../WEB-INF/app/models/active_rule_change.rb | 8 ++++ .../app/views/profiles/changelog.html.erb | 46 +++++++++---------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_change.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_change.rb index d52c149b6ea..b58f811538e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_change.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_change.rb @@ -22,6 +22,14 @@ class ActiveRuleChange < ActiveRecord::Base belongs_to :rule has_many :active_rule_param_changes, :dependent => :destroy + def action_text + case enabled + when true then "enabled" + when false then "disabled" + when nil then "modified" + end + end + def old_severity_text Sonar::RulePriority.to_s old_severity end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb index 6a616bfe06c..a46645b46fb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb @@ -6,66 +6,62 @@ - - - + + + - <% current_version = -1 + <% current_version = -1 @changes.each do |change| %> <% if current_version != change.profile_version %> <% current_version = change.profile_version end - %> + %> - - + +
ActionBy DateRule nameUserActionRule Parameters
-
-

Version <%=change.profile_version%>

-
+
+

Version <%=change.profile_version%>

+
<%=case change.enabled - when true then "Enabled" - when false then "Disabled" - when nil then "Modified" - end%><%=change.user_login%> <%=change.change_date.strftime("%Y-%m-%d %H:%M:%S")%><%=change.user_login%><%=change.action_text%> <%=change.rule.name%> <% if change.old_severity if change.new_severity %> - Severity changed from <%= change.old_severity_text %> to + Severity changed from <%= image_tag "priority/#{change.old_severity_text}.png" %><%= change.old_severity_text %> to <% else %> - Severity was <%= change.old_severity_text %> + Severity was <%= image_tag "priority/#{change.old_severity_text}.png" %><%= change.old_severity_text %> <% end end %> - <% if change.new_severity + <% if change.new_severity if change.old_severity %> - <%= change.new_severity_text %> + <%= image_tag "priority/#{change.new_severity_text}.png" %><%= change.new_severity_text %> <% else %> - Severity set to <%= change.new_severity_text %> + Severity set to <%= image_tag "priority/#{change.new_severity_text}.png" %><%= change.new_severity_text %> <% end end %> <% if (change.old_severity or change.new_severity) and change.parameters.size > 0 %>
<% end %> <% change.parameters.each do |param_change| %> - Parameter <%=param_change.name %> + Parameter <%=param_change.name %> <% if not param_change.old_value %> - set to <%= param_change.new_value %> - <% elsif not param_change.new_value + set to <%= param_change.new_value %> + <% elsif not param_change.new_value if change.enabled == false %> - was <%= param_change.old_value %> + was <%= param_change.old_value %> <% else %> - reset to default value (was <%= param_change.old_value %>) + reset to default value (was <%= param_change.old_value %>) <% end else %> - changed from <%= param_change.old_value %> to <%= param_change.new_value %> + changed from <%= param_change.old_value %> to <%= param_change.new_value %> <% end %> <%= "
" unless param_change == change.parameters.last %> <% end%> -- 2.39.5