From 6f800383cd8bff8f4b6394009987adfa222df619 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 22 May 2014 16:14:39 +0200 Subject: [PATCH] Improve the description widget --- .../plugins/core/widgets/description.html.erb | 147 +++++++++--------- sonar-server/src/main/less/dashboard.less | 46 ++++++ 2 files changed, 119 insertions(+), 74 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb index da77b97155f..0d6088a6eba 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/description.html.erb @@ -1,87 +1,86 @@
+

+ + <%= @project.name -%> +

+ <%= h @project.key -%> + <% if @project.description.present? %> -

<%= h @project.description %>

+

<%= h @project.description %>

<% end %> - - - - - - - <% if @project.language %> - - - - - <% end %> - - <% - profiles_measure = measure(Metric::PROFILES) - if profiles_measure && !profiles_measure.data.blank? - profiles = JSON.parse profiles_measure.data - %> - - - - - <% - else - profile_measure=@snapshot.measure(Metric::PROFILE) - if profile_measure - %> - - - - - <% end - end %> - - <% - using_default=false - quality_gate=Property.value('sonar.qualitygate', @resource && @resource.id, nil) - unless quality_gate - quality_gate=Property.value('sonar.qualitygate', nil, nil) - using_default=false || quality_gate - end - if quality_gate - qgate = Internal.quality_gates.get(quality_gate.to_i) - %> - - - - - <% end %> - <% unless @project.project_links.empty? %> - - - - - <% end %> - -
<%= message('widget.description.key') -%>: <%= h @project.key -%>
<%= message('widget.description.language') -%>: <%= Api::Utils.language_name(@project.language) -%>
<%= message('widget.description.profiles') -%>: - <% profiles.each_with_index do |profile, i| %> - <%= Api::Utils.language_name(profile['language']) -%>: <%= link_to profile['name'], {:controller => '/profiles', :action => 'show', :id => profile['id']}, :id => profile['language'] + '_profile_link' -%> (<%= message('widget.description.profile_version_x', :params => profile['version']) -%>) - <% if i < (profiles.size - 1) %> + <% + profiles_measure = measure(Metric::PROFILES) + if profiles_measure && !profiles_measure.data.blank? + profiles = JSON.parse profiles_measure.data + %> +

+ <%= message('widget.description.profiles') -%>: + <% profiles.each_with_index do |profile, i| %> + + <%= Api::Utils.language_name(profile['language']) -%>: <%= link_to profile['name'], {:controller => '/profiles', :action => 'show', :id => profile['id']}, :class => 'widget-link', :id => profile['language'] + '_profile_link' -%> + + (<%= message('widget.description.profile_version_x', :params => profile['version']) -%>) + <% if i < (profiles.size - 1) %>
- <% end %> <% end %> -

<%= message('widget.description.profile') -%>:<%= link_to profile_measure.data, {:controller => '/profiles', :action => 'show', :id => profile_measure.value.to_i}, :id => 'profile_link' -%> (<%= message('widget.description.profile_version_x', :params => format_measure('profile_version', :default => '1')) -%>)
<%= message('widget.description.qualitygate') -%>:<%= link_to qgate.getName(), (url_for :controller => '/quality_gates') + '#show/' + quality_gate, :id => 'qgate_link' -%> + <% end %> +

+ <% + else + profile_measure=@snapshot.measure(Metric::PROFILE) + if profile_measure + %> +

+ <%= message('widget.description.profile') -%>: + + <%= link_to profile_measure.data, {:controller => '/profiles', :action => 'show', :id => profile_measure.value.to_i}, :class => 'widget-link', :id => 'profile_link' -%> + + (<%= message('widget.description.profile_version_x', :params => format_measure('profile_version', :default => '1')) -%>) +

+ <% end + end %> + + <% + using_default=false + quality_gate=Property.value('sonar.qualitygate', @resource && @resource.id, nil) + unless quality_gate + quality_gate=Property.value('sonar.qualitygate', nil, nil) + using_default=false || quality_gate + end + if quality_gate + qgate = Internal.quality_gates.get(quality_gate.to_i) + %> +

+ + <%= message('widget.description.qualitygate') -%>: + <%= link_to qgate.getName(), (url_for :controller => '/quality_gates') + '#show/' + quality_gate, :class => 'widget-link', :id => 'qgate_link' -%> <% if using_default %> (<%= message('default') -%>) <% end %> - -

<%= message('widget.description.links') -%>:
+ + <% end %> + + <% end %>
diff --git a/sonar-server/src/main/less/dashboard.less b/sonar-server/src/main/less/dashboard.less index c2e109a8f5b..3fa9bfdc458 100644 --- a/sonar-server/src/main/less/dashboard.less +++ b/sonar-server/src/main/less/dashboard.less @@ -408,4 +408,50 @@ .widget-histogram-line-bar { min-width: 1px; background-color: @blue; +} + +// Description Widget + +.description-widget-project { + display: inline-block; + line-height: 1.5; + margin-right: 10px; + font-size: 18px; + font-weight: 300; +// text-transform: uppercase; + white-space: nowrap; +} + +.description-widget-description { + margin: 7px 0; + line-height: 1.5; +} + +.description-widget-key { + color: @secondFontColor; + font-size: @smallFontSize; + font-weight: 300; + white-space: nowrap; +} + +.description-widget-links { + + & > li { + display: inline-block; + vertical-align: top; + padding: 5px 25px 5px 0; + + & > a { + font-size: @baseFontSize; + + & > i, & > i:before { + vertical-align: top; + font-size: 16px; + } + } + } +} + +.description-widget-link-data { + margin-top: 7px; } \ No newline at end of file -- 2.39.5