From 4ea160c7b48e895f88b71b3d05b962d6aa27d00c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 5 Dec 2012 12:22:22 +0100 Subject: [PATCH] SONAR-3825 improve l10n --- .../resources/org/sonar/l10n/core.properties | 26 ++++++++++++-- .../WEB-INF/app/models/measure_filter.rb | 6 ++-- .../models/measure_filter_display_treemap.rb | 3 +- .../views/measures/_display_treemap.html.erb | 8 +++-- .../app/views/measures/_sidebar.html.erb | 36 +++++++++---------- .../app/views/measures/manage.html.erb | 8 ++--- .../app/views/measures/search.html.erb | 2 +- .../src/main/webapp/stylesheets/style.css | 2 -- 8 files changed, 58 insertions(+), 33 deletions(-) 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 e7af1a90909..95c4313c358 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 @@ -380,6 +380,28 @@ session.flash_notice.logged_out=You have been logged out. # MEASURE FILTERS # #------------------------------------------------------------------------------ +measure_filter.display_as=Display as +measure_filter.shared_with_all_users=Shared with all users +measure_filter.private=Private +measure_filter.manage.shared_filters=Shared Filters +measure_filter.manage.my_filters=My Filters +measure_filter.criteria.age=Age +measure_filter.criteria.date=Date +measure_filter.criteria.only_favourites=Favourites only +measure_filter.criteria.key=Key +measure_filter.criteria.name=Name +measure_filter.criteria.language=Language +measure_filter.criteria.metric=Metric +measure_filter.criteria.age.from_date=From date +measure_filter.criteria.age.to_date=To date +measure_filter.criteria.age.note=year-month-day (2012-01-31) +measure_filter.criteria.age.more_than=More than +measure_filter.criteria.age.within_last=Within the last +measure_filter.criteria.age.days_ago=days ago +measure_filter.criteria.age.days=days +measure_filter.new_search=New search +measure_filter.more_criteria=+ More Criteria +measure_filter.languages=Languages measure_filter.col.date=Date measure_filter.col.description=Description measure_filter.col.key=Key @@ -388,8 +410,6 @@ measure_filter.col.links=Links measure_filter.col.name=Name measure_filter.col.short_name=Short Name measure_filter.col.version=Version -measure_filter.short_col.language=Lang. -measure_filter.short_col.short_name=Name measure_filter.missing_name=Name is missing measure_filter.name_too_long=Name is too long measure_filter.sharing=Sharing @@ -398,11 +418,11 @@ measure_filter.are_you_sure_want_delete_filter_x=Are you sure that you want to d measure_filter.title_shared_filters=Shared Filters measure_filter.key_like=Key like measure_filter.name_contains=Name contains -measure_filter.only_favourites=Favourites only measure_filter.manage_filters=Manage Filters measure_filter.display.list=List measure_filter.display.treemap=Treemap measure_filter.configure_columns=Configure Columns +measure_filter.too_many_results=Too many results. Please refine your search. #------------------------------------------------------------------------------ # diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb index 143a6a5a9e0..b2ebe1a5c7e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb @@ -80,10 +80,12 @@ class MeasureFilter < ActiveRecord::Base @metrics ||= [] end - def metrics=(array) - @metrics = array + # Set the metrics of the result measures to load. Array of Metric or String. + def metrics=(array=[]) + @metrics = array.map{|m| m.is_a?(Metric) ? m : Metric.by_key(m)}.compact end + # Enable the loading of result links. False by default def require_links=(flag) @require_links=flag end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb index 59dc40aaa2e..7e1648f22a4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb @@ -23,6 +23,7 @@ class MeasureFilterDisplayTreemap < MeasureFilterDisplay KEY = :treemap PROPERTY_KEYS = Set.new(['tmSize', 'tmColor']) + MAX_RESULTS = 1000 attr_reader :id, :size, :size_metric, :color_metric def initialize(filter, options) @@ -35,7 +36,7 @@ class MeasureFilterDisplayTreemap < MeasureFilterDisplay filter.set_criteria_value('sort', "metric:#{@size_metric.key}") if @size_metric filter.set_criteria_value('asc', 'true') - filter.pagination.per_page = 500 + filter.pagination.per_page = MAX_RESULTS filter.pagination.page = 1 end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb index 8daad3011bb..46de81a4af9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb @@ -49,7 +49,8 @@ <% end %> -<% content_for :script do %> +<% unless defined? widget + content_for :script do %> -<% end %> +<% end +end %> <% if filter.results.empty? %>

<%= message('no_data') -%>

+<% elsif filter.pagination.pages>1 %> +

<%= message('measure_filter.too_many_results') -%>

<% else %>
<%= filter.display.html -%> 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 index e6776650136..a94004f1607 100644 --- 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 @@ -29,10 +29,10 @@ } var hiddenConditionIndexes = [<%= hidden_condition_indexes.join(',') -%>]; $j(document).ready(function () { - $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'Languages'}); + $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'<%= message 'measure_filter.languages' -%>'}); $j('#select-qualifiers').select2({allowClear:true, width:'100%', placeholder:'Resources'}); $j('#more-criteria') - .select2({allowClear:true, width:'100%', placeholder:'+ More Criteria'}) + .select2({allowClear:true, width:'100%', placeholder:'<%= message 'measure_filter.more_criteria' -%>'}) .on("change", function (e) { $j("#criteria-" + e.val).insertBefore($j("#more-td")).show(); if (e.val == 'lang') { @@ -108,7 +108,7 @@
  • > - <%= message 'measure_filter.only_favourites' %>:
    + <%= message 'measure_filter.criteria.only_favourites' %>:
    <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%>
  • @@ -123,36 +123,36 @@ <% end %>
  • > - From date: + <%= message 'measure_filter.criteria.age.from_date' -%>:
    - To date: + <%= message 'measure_filter.criteria.age.to_date' -%>:
    - year-month-day (2012-01-31) + <%= message 'measure_filter.criteria.age.note' -%>:
  • > - More than - days ago -
    Within the last - days + <%= message 'measure_filter.criteria.age.more_than' -%>: + <%= message 'measure_filter.criteria.age.days_ago' -%> +
    <%= message 'measure_filter.criteria.age.within_last' -%>: + <%= message 'measure_filter.criteria.age.days' -%>
  • - New search + <%= message 'measure_filter.new_search' -%> <% if logged_in? %> <% if @filter.id==nil || @filter.user_id==current_user.id %> - <%= message('save') -%> 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 d4d3773f017..e1c9a1976ae 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 @@ -29,7 +29,7 @@
  • -

    My Filters

    +

    <%= message 'measure_filter.manage.my_filters' -%>

    @@ -58,9 +58,9 @@
    <% if filter.shared %> - Shared with all users + <%= message 'measure_filter.shared_with_all_users' -%> <% else %> - Private + <%= message 'measure_filter.private' -%> <% end %> @@ -84,7 +84,7 @@
    -

    Shared Filters

    +

    <%= message 'measure_filter.manage.shared_filters' -%>

    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 ac6c9ca7309..0af8480d965 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 @@ -17,7 +17,7 @@ <% end %>
  • - Display as: + <%= message 'measure_filter.display_as' -%>: <% MeasureFilterDisplay.keys.each do |display_key| %> <%= link_to_if display_key!=@filter.display.key, message("measure_filter.display.#{display_key}"), params.merge(:action => 'search', :display => display_key, :id => @filter.id) -%> <% end %> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index 903bec852fc..92232788e72 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -2140,7 +2140,6 @@ table.nowrap td, td.nowrap, th.nowrap { height: 24px; padding: 0 8px; cursor: pointer !important; - color: red !important; float: none !important; } @@ -2150,7 +2149,6 @@ table.nowrap td, td.nowrap, th.nowrap { .dropdown-menu li:hover a { color: #fff !important; - font-weight: bold !important; } .dropdown-menu a { -- 2.39.5