From a9a81eb94536523cffc684fd5200666e964b6b95 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 10 Dec 2012 11:46:36 +0100 Subject: [PATCH] Do not display to anonymous the measure filters that have the criteria "Favourites only" --- .../resources/org/sonar/l10n/core.properties | 3 ++- .../core/widgets/measure_filter_list.html.erb | 18 +++++++++------ .../widgets/measure_filter_treemap.html.erb | 23 +++++++++++-------- 3 files changed, 27 insertions(+), 17 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 89ac6e6ba43..deb28d04312 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 @@ -409,6 +409,7 @@ measure_filter.col.language=Language measure_filter.col.links=Links measure_filter.col.name=Name measure_filter.col.short_name=Short Name +measure_filter.col.version=Version measure_filter.abbr.date=Date measure_filter.abbr.description=Description measure_filter.abbr.key=Key @@ -416,7 +417,7 @@ measure_filter.abbr.language=Lang. measure_filter.abbr.links=Links measure_filter.abbr.name=Name measure_filter.abbr.short_name=Name -measure_filter.col.version=Version +measure_filter.abbr.version=Version measure_filter.missing_name=Name is missing measure_filter.name_too_long=Name is too long measure_filter.sharing=Sharing diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb index 910e1ad2132..dbfaacd82e9 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_list.html.erb @@ -2,12 +2,16 @@ filter_id = widget_properties['filter'] page_size = widget_properties['pageSize'] filter = MeasureFilter.find_by_id(filter_id.to_i) if filter_id - if filter && (!filter.require_authentication? || logged_in?) + if filter filter.load_criteria_from_data - filter.set_criteria_value('display', 'list') - filter.set_criteria_value('pageSize', page_size) - filter.execute(self, :user => current_user) - @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'} + if !filter.require_authentication? || logged_in? + filter.set_criteria_value('display', 'list') + filter.set_criteria_value('pageSize', page_size) + filter.execute(self, :user => current_user) + @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'} %> - <%= render :partial => "measures/display_#{filter.display.key}", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %> -<% end %> \ No newline at end of file + <%= render :partial => "measures/display_#{filter.display.key}", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %> + <% + end + end + %> \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb index 22dcc59b78f..599d802ae84 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measure_filter_treemap.html.erb @@ -3,21 +3,26 @@ size_metric = widget_properties['sizeMetric'] color_metric = widget_properties['colorMetric'] filter = MeasureFilter.find_by_id(filter_id.to_i) if filter_id - if filter && (!filter.require_authentication? || logged_in?) + if filter url_options = {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'treemap'} filter.load_criteria_from_data filter.set_criteria_value('display', 'treemap') if size_metric - filter.set_criteria_value('tmSize', size_metric.key) - url_options['tmSize']=size_metric.key + filter.set_criteria_value('tmSize', size_metric.key) + url_options['tmSize']=size_metric.key end if color_metric - filter.set_criteria_value('tmColor', color_metric.key) - url_options['tmColor']=color_metric.key + filter.set_criteria_value('tmColor', color_metric.key) + url_options['tmColor']=color_metric.key end - filter.execute(self, :user => current_user) - @widget_title = link_to h(filter.name), url_options + if !filter.require_authentication? || logged_in? + filter.execute(self, :user => current_user) + + @widget_title = link_to h(filter.name), url_options %> - <%= render :partial => "measures/display_#{filter.display.key}", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %> -<% end %> \ No newline at end of file + <%= render :partial => "measures/display_#{filter.display.key}", :locals => {:edit_mode => false, :widget => widget, :filter => filter} %> + <% + end + end + %> \ No newline at end of file -- 2.39.5