From: David Gageot Date: Tue, 15 May 2012 14:14:41 +0000 (+0200) Subject: SONAR-2073 Get rid of time period X-Git-Tag: 3.1~190 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec607552fad9e800da5bf29595b266404d2671cd;p=sonarqube.git SONAR-2073 Get rid of time period - remove the "Differential period" dropdown list - if a differential period is defined on the filter, display this differential period close to the name of the filter. Example : Projects ( over 5 days) --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb index cbf7fd35d00..a78fb5c411c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb @@ -37,11 +37,10 @@ module WidgetPropertiesHelper text_field_tag definition.key(), val, :size => 10 elsif definition.type.name()==WidgetProperty::TYPE_FILTER - user_filters = ::Filter.find(:all, :conditions => ['user_id=?', current_user.id]).sort_by(&:id).collect { |f| "" } - shared_filters = ::Filter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:id).collect { |f| "" } - all_filters = '' + user_filters.to_s + '' + '' + shared_filters.to_s + '' + user_filters = options(value, ::Filter.find(:all, :conditions => ['user_id=?', current_user.id]).sort_by(&:id)) + shared_filters = options(value, ::Filter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:id)) - select_tag definition.key(), all_filters + select_tag definition.key(), option_group('My Filters', user_filters) + option_group('Shared Filters', shared_filters) else hidden_field_tag definition.key() @@ -49,7 +48,15 @@ module WidgetPropertiesHelper end def resource_value_field(value) - select_tag 'resource_id', Project.all(:conditions => {:scope => 'PRJ', :qualifier => 'TRK'}).collect { |f| "" } + select_tag 'resource_id', options(value, Project.all(:conditions => {:scope => 'PRJ', :qualifier => 'TRK'})) + end + + def options(value, values) + values.collect { |f| "" }.to_s + end + + def option_group(name, options) + options.empty? ? '' : "" + options + "" end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb index e3bf0099291..e3117eb9ed7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb @@ -2,7 +2,12 @@ <% if widget.properties_as_hash['filter'] %> <% filter = ::Filter.find_by_id(widget.properties_as_hash['filter']) %> -
<%= filter.name if filter -%>
+
+ <% if filter %> + <%= filter.name -%> + <%= period_names[filter.period_index] if filter.period_index -%> + <% end %> +
<% elsif @resource && !widget.java_definition.global %>
<%= @resource.name -%>
<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb index 5c07ddac24f..3a78cca4b30 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb @@ -1,22 +1,5 @@ <% filter=@filter_context.filter %>
-<% unless edit_mode %> -
-
-
- - <% if params[:did] %> - - <% end %> -
-
-
-<% end %>