From 02a60335f14ddfc956d7a0b17de1532b81f9af03 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 30 Nov 2012 23:26:11 +0100 Subject: [PATCH] SONAR-3825 improve style --- .../resources/org/sonar/l10n/core.properties | 3 +- .../app/controllers/account_controller.rb | 2 - .../app/controllers/measures_controller.rb | 1 + .../WEB-INF/app/helpers/dashboard_helper.rb | 1 + .../WEB-INF/app/views/account/index.html.erb | 165 +++++++------ .../WEB-INF/app/views/alerts/index.html.erb | 4 +- .../app/views/comparison/index.html.erb | 232 +++++++++--------- .../app/views/dependencies/index.html.erb | 10 +- .../app/views/layouts/_user_panel.html.erb | 14 +- .../app/views/measures/_display_list.html.erb | 4 +- .../app/views/measures/_sidebar.html.erb | 172 +++++++++++++ .../app/views/measures/manage.html.erb | 191 +++++++------- .../app/views/measures/search.html.erb | 222 +---------------- .../WEB-INF/app/views/profiles/index.html.erb | 4 +- .../WEB-INF/app/views/reviews/index.html.erb | 166 ++++++------- .../views/rules_configuration/index.html.erb | 3 +- .../main/webapp/javascripts/recent-history.js | 11 +- .../src/main/webapp/stylesheets/layout.css | 81 ++++-- .../src/main/webapp/stylesheets/style.css | 2 +- 19 files changed, 643 insertions(+), 645 deletions(-) create mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index b6e1241c950..e76e1e232cd 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -300,7 +300,6 @@ layout.dashboards=Dashboards layout.tools=Tools layout.user_panel.my_profile=My profile layout.user_panel.recent_history.title=Recent history -layout.user_panel.recent_history.clear=Clear layout.user_panel.me=Me layout.user_panel.anonymous_user=Anonymous @@ -521,7 +520,7 @@ reviews.filtered_by.to=To date #------------------------------------------------------------------------------ comparison.compare=Compare -comparison.add_a_new_metric=Add a new metric +comparison.add_metric=Add metric comparison.select_resource_to_compare=Select a resource to compare comparison.select_version=Select a version comparison.remove_resource=Remove resource diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb index fa963c06168..beac85292fb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb @@ -19,8 +19,6 @@ # class AccountController < ApplicationController - SECTION=Navigation::SECTION_CONFIGURATION - before_filter :login_required def index diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb index 19c5c8b8f1a..ce19f9f8982 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb @@ -91,6 +91,7 @@ class MeasuresController < ApplicationController def manage access_denied unless logged_in? add_breadcrumbs(ROOT_BREADCRUMB, message('measure_filter.manage')) + @filter = MeasureFilter.new @shared_filters = MeasureFilter.find(:all, :include => :user, :conditions => ['shared=? and (user_id is null or user_id<>?)', true, current_user.id]) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb index 49b9cbdf1bc..582bf95e120 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb @@ -21,6 +21,7 @@ module DashboardHelper include WidgetPropertiesHelper include MetricsHelper include FiltersHelper + include MeasuresHelper def dashboard_action(action_name, opts={}) if @resource { :action => action_name, :did => @dashboard.id, :id => @resource.id }.merge!(opts) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb index 52ee54f7a63..aaabf828d4d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb @@ -1,86 +1,91 @@ -

<%= message('my_profile.page') -%>

-
- - - - - - - - - - - - - - - - - -
<%= message('my_profile.login') -%>:<%= current_user.login %>
<%= message('my_profile.name') -%>:<%= current_user.name %>
<%= message('my_profile.email') -%>:<%= current_user.email %>
<%= message('my_profile.groups') -%>:<%= current_user.groups.sort.map(&:name).join(', ') %>
-
+
+

<%= message('my_profile.page') -%>

-<% if User.editable_password? %> -

<%= message('my_profile.password.title') -%>

-
- <% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%> - - - - - - - - - - - - - - - - - -
<%= password_field_tag 'old_password' %>
<%= password_field_tag 'password' %>
<%= password_field_tag 'password_confirmation' %>
<%= submit_tag message('my_profile.password.submit') %>
- <% end %> +
+ + + + + + + + + + + + + + + + + +
<%= message('my_profile.login') -%>:<%= current_user.login %>
<%= message('my_profile.name') -%>:<%= current_user.name %>
<%= message('my_profile.email') -%>:<%= current_user.email %>
<%= message('my_profile.groups') -%>:<%= current_user.groups.sort.map(&:name).join(', ') %>
+
- -
-<% end -%> + <% if User.editable_password? %> +

<%= message('my_profile.password.title') -%>

-

<%= message('my_profile.notifications.title') -%>

-
-<% form_tag({:action => 'update_notifications'}, {:method => 'post'}) do %> - - - - <% for channel in @channels %> - +
+ <% form_tag({:action => 'change_password'}, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%> +
<%= message('notification.channel.' + channel.getKey()) -%>
+ + + + + + + + + + + + + + + + +
<%= password_field_tag 'old_password' %>
<%= password_field_tag 'password' %>
<%= password_field_tag 'password_confirmation' %>
<%= submit_tag message('my_profile.password.submit') %>
<% end %> - - <% for dispatcher in @dispatchers %> - - <%= message('notification.dispatcher.' + dispatcher.getKey()) -%> - - <% - for channel in @channels - notification_id = dispatcher.getKey() + '.' + channel.getKey() - check_box_id = 'notifications[' + notification_id + ']' - check_box_checked = @notifications[notification_id] - %> - <%= check_box_tag check_box_id, 'true', check_box_checked %> + + +
+ <% end -%> + +

<%= message('my_profile.notifications.title') -%>

+ +
+ <% form_tag({:action => 'update_notifications'}, {:method => 'post'}) do %> + + + + <% for channel in @channels %> + + <% end %> + + <% for dispatcher in @dispatchers %> + + + + <% end %> - - + + + + +
<%= message('notification.channel.' + channel.getKey()) -%>
<%= message('notification.dispatcher.' + dispatcher.getKey()) -%> + <% + for channel in @channels + notification_id = dispatcher.getKey() + '.' + channel.getKey() + check_box_id = 'notifications[' + notification_id + ']' + check_box_checked = @notifications[notification_id] + %> + <%= check_box_tag check_box_id, 'true', check_box_checked %> + <% end %> +
<%= submit_tag message('my_profile.notifications.submit') %>
<% end %> - - - <%= submit_tag message('my_profile.notifications.submit') %> - - -<% end %> -
+
+ \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb index 2b8b029a0f9..65dcde48b01 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb @@ -1,4 +1,5 @@ -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Alerts'} %> +
+ <%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Alerts'} %> <% if is_admin? %>
@@ -44,3 +45,4 @@
+
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb index 9000761e3a4..589eb1fb02f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb @@ -1,35 +1,87 @@ - +<% content_for :style do %> + +<% end %> +<% content_for :script do %> + +<% end %> + +
+
+
+ + + + + - + <% - last_index = @snapshots.size-1 - @snapshots.each_with_index do |s, index| + last_index = @snapshots.size-1 + @snapshots.each_with_index do |s, index| %> <% end %> - + - - - - <% - last_index = @metrics.size-1 - @metrics.each_with_index do |m, index| + + + + <% + last_index = @metrics.size-1 + @metrics.each_with_index do |m, index| %> - + <% @snapshots.each do |s| %> <% end %> - - <% end %> - - -
<%= metric_select_tag 'new_metric', @metric_to_choose, { - :allow_empty => true, - :select2_options => {'placeholder' => "'" + message('comparison.add_a_new_metric') + "'"} - } -%> + :allow_empty => true, + :select2_options => {'placeholder' => "'" + message('comparison.add_metric') + "'"} + } -%> @@ -62,7 +114,10 @@ <%= s.event(EventCategory::KEY_VERSION).name -%>
<%= human_short_date s.created_at -%> -
+ +
+ +
<% if index < last_index %> @@ -75,30 +130,30 @@
<%= resource_select_tag 'new_resource', { - :resource_type_property => 'comparable', - :width => '250px', - :select2_options => {'placeholder' => "'" + message('comparison.select_resource_to_compare') + "'"} - } -%> + :resource_type_property => 'comparable', + :width => '250px', + :select2_options => {'placeholder' => "'" + message('comparison.select_resource_to_compare') + "'"} + } -%> - +
@@ -142,68 +197,17 @@ <%= format_measure s.measure(m) -%>
- - + <% end %> + + +
+
- - diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb index 631e84f3563..0b310942b36 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb @@ -1,3 +1,4 @@ +<% content_for :style do %> +<% end %> +

@@ -98,4 +101,5 @@ padding: 5px; $$('#artifacts_col tr.selected').each(function(item) {item.scrollIntoView(true);}); $$('#versions_col tr.selected').each(function(item) {item.scrollIntoView(true);}); $$('#results_col tr.selected').each(function(item) {item.scrollIntoView(true);}); - \ No newline at end of file + +
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb index c4c2635f0c6..e1727eb5a77 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb @@ -1,9 +1,7 @@ @@ -24,15 +22,15 @@  â€“  <%= message('default_filters.page') -%>  â€“  - <%= message('layout.logout') -%> + <%= message('layout.logout') -%> <% else %> <%= message('layout.user_panel.anonymous_user') -%> <% end %> - @@ -41,10 +39,10 @@ \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb index 31f57645f72..54128af8d86 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb @@ -144,9 +144,9 @@ <% end %> <% @filter.display.columns.each_with_index do |column, index| %> - + <%= image_tag("controls/resultset_previous.png") -%> - <%= image_tag("bin_closed.png") -%> + <%= image_tag("cross-gray.png") -%> <%= image_tag("controls/resultset_next.png") -%> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb new file mode 100644 index 00000000000..2d8b5a07a54 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb @@ -0,0 +1,172 @@ +<% + hidden_condition_indexes = [] + for i in 1..3 do + unless @filter.criteria("c#{i}_metric") && @filter.criteria("c#{i}_val") + hidden_condition_indexes << i + end + end +%> +<% content_for :script do %> + +<% end %> + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb index f3f23198291..d54bf068d18 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb @@ -22,100 +22,105 @@ }); <% end %> - -

My Filters

- - - - - - - - - - - <% if current_user.measure_filters.empty? %> - - - - <% else %> - <% current_user.measure_filters.each do |filter| %> - - - - +
<%= message('name') -%><%= message('measure_filter.sharing') -%><%= message('operations') -%>
<%= message('filters.no_filters') -%>
- <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
<%= h filter.description -%>
- <% end %> -
- <% if filter.shared %> - Shared with all users - <% else %> - Private +
+
+ <%= render :partial => 'measures/sidebar' -%> +
+
+
+

My Filters

+ + + + + + + + + + + <% if current_user.measure_filters.empty? %> + + + + <% else %> + <% current_user.measure_filters.each do |filter| %> + + + + + + <% end %> - - - - <% end %> - <% end %> - -
<%= message('name') -%><%= message('measure_filter.sharing') -%><%= message('operations') -%>
<%= message('filters.no_filters') -%>
+ <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> +
<%= h filter.description -%>
+ <% end %> +
+ <% if filter.shared %> + Shared with all users + <% else %> + Private + <% end %> + + <%= message('edit') -%> +   + <%= message('copy') -%> +   + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", + :class => 'link-action link-red', + :id => "delete_#{filter.name.parameterize}", + :confirm_button => message('delete'), + :confirm_title => 'measure_filter.delete_confirm_title', + :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', + :confirm_msg_params => [filter.name] -%> +
- <%= message('edit') -%> -   - <%= message('copy') -%> -   - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", - :class => 'link-action link-red', - :id => "delete_#{filter.name.parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'measure_filter.delete_confirm_title', - :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', - :confirm_msg_params => [filter.name] -%> -
+ <% end %> +
-
+
-

Shared Filters

- - - - - - - - - - - <% if @shared_filters.empty? %> - - - - <% else %> - <% @shared_filters.each do |filter| %> - - - +
<%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
<%= message('filters.no_filters') -%>
- <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
<%= h filter.description -%>
+

Shared Filters

+ + + + + + + + + + + <% if @shared_filters.empty? %> + + + + <% else %> + <% @shared_filters.each do |filter| %> + + + + + + <% end %> - - - - - - <% end %> - <% end %> - -
<%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
<%= message('filters.no_filters') -%>
+ <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> +
<%= h filter.description -%>
+ <% end %> +
+ <%= filter.user ? h(filter.user.name) : '-' -%> + + <%= message('copy') -%> +
- <%= filter.user ? h(filter.user.name) : '-' -%> - - <%= message('copy') -%> -
- - + <% end %> +
+ + + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb index f1052353d1e..531e1594cd0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb @@ -1,230 +1,14 @@ -<% content_for :style do %> - -<% end %> -<% - hidden_condition_indexes = [] - for i in 1..3 do - unless @filter.criteria("c#{i}_metric") && @filter.criteria("c#{i}_val") - hidden_condition_indexes << i - end - end -%> -<% content_for :script do %> - -<% end %>
- <% if logged_in? %> -
    - <% current_user.favourited_measure_filters.each do |filter| %> -
  • - <%= h filter.name -%> -
  • - <% end %> -
- <%= message('manage') %> -
- <% end %> - -
- <% if @filter.id %> - - <% end %> - <% - if @filter.display - @filter.display.url_params.each do |k_v_array| - if k_v_array[1].is_a?(String) - %> - <%= hidden_field_tag k_v_array[0], k_v_array[1] -%> - <% else - k_v_array[1].each do |string_val| - %> - <%= hidden_field_tag "#{k_v_array[0]}[]", string_val -%> - <% end - end - end - end - %> - - - - - - - - - > - - - > - - - > - - - > - - - - <% condition_metrics = Metric.all.select { |m| m.numeric? } %> - <% for i in 1..3 %> - > - - - <% end %> - > - - - > - - - - - - - - - - - - - -
- <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource, :placeholder => 'Path' -%> -
- <% - qualifiers = Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| - [message("qualifiers.#{resource_type.getQualifier()}"), resource_type.getQualifier()] - end - %> - <%= select_tag 'qualifiers[]', options_for_select(qualifiers, @filter.criteria['qualifiers']||''), :multiple => true, :id => 'select-qualifiers' -%> -
- <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> - <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']), :multiple => true, :id => 'select-lang', 'data-placeholder' => 'Languages' -%> -
- <%= message('measure_filter.name_contains') -%>:
-
- <%= message('measure_filter.key_like') -%>:
-
- <%= message 'measure_filter.only_favourites' %>:
- <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%> -
- <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> - <%= select_tag "c#{i}_period", options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria("c#{i}_period")) -%> -
- <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> - "> -
- From date: - -
- To date: -
- year-month-day (2012-01-31) -
- More than - days ago -
Within the last - days -
- -
- -
- New search - <% if logged_in? %> - <% if @filter.id==nil || @filter.user_id==current_user.id %> - - <%= message('save') -%> - <% end %> - <% if @filter.id %> - - <%= message('copy') -%> - <% end %> - <% end %> -
-
+ <%= render :partial => 'measures/sidebar' -%>
<% if @filter.results && @filter.display %>
- <% if @filter.name %> -

- <%= h @filter.name -%> - <% if @filter.description.present? %> - - <%= h @filter.description -%> - <% end %> -

+ <% if @filter.description.present? %> +

<%= h @filter.description -%>

<% end %> <% diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index c581f4f1e5c..1d824c35d5c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -1,3 +1,4 @@ +
  • @@ -109,4 +110,5 @@

    -<% end %> \ No newline at end of file +<% end %> +
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb index f618f2a8a78..9a7831cd11c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb @@ -18,102 +18,82 @@ <% end %>