From f1c7ed956b431928cfd126342b83515dd845eefc Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 28 Oct 2010 11:37:59 +0000 Subject: [PATCH] SONAR-1643 manage default dashboards for anonymous users --- .../app/controllers/admin_dashboards_controller.rb | 6 +++--- .../WEB-INF/app/controllers/dashboards_controller.rb | 2 +- .../app/views/admin_dashboards/index.html.erb | 12 ++++++------ .../WEB-INF/app/views/dashboards/index.html.erb | 7 ++++++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb index 7824a235adc..bd97167f741 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb @@ -23,7 +23,7 @@ class AdminDashboardsController < ApplicationController verify :method => :post, :only => [:up, :down, :remove, :add], :redirect_to => {:action => :index} before_filter :admin_required - before_filter :load_active_dashboards + before_filter :load_default_dashboards def index @default_dashboards=::Dashboard.find(:all, :conditions => {:shared => true}) @@ -95,7 +95,7 @@ class AdminDashboardsController < ApplicationController private - def load_active_dashboards - @actives=ActiveDashboard.default_active_dashboards + def load_default_dashboards + @actives=ActiveDashboard.default_dashboards end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb index 4fc1e09562e..a2d7f67dcf0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb @@ -75,7 +75,7 @@ class DashboardsController < ApplicationController else # TODO explicit error end - redirect :action => 'index', :resource => params[:resource] + redirect_to :action => 'index', :resource => params[:resource] end def delete diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb index aade1013455..3598fc416f0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb @@ -1,6 +1,6 @@

Default dashboards

-

These dashboards are displayed to anonymous users or users that haven't customized their dashboards.

-
+

These dashboards are displayed to anonymous users or users who have not customized their dashboards.

+ @@ -41,9 +41,9 @@


-

Admin dashboards

-

These dashboards can be added to default dashboards.

-
+

Shared dashboards

+

These dashboards can be added to default dashboards.

+ @@ -60,7 +60,7 @@ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb index 027299e3d03..913b361d6a2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb @@ -20,7 +20,12 @@ else @actives.each_with_index do |active,index| %> - + <% if is_admin %>
<%= h(dashboard.name) -%>
- <%= dashboard.description %> + <%= dashboard.description %>
<%= h(dashboard.user.name) if dashboard.user %> <%= link_to 'Add to defaults', {:action => 'add', :id => dashboard.id}, :method => :post, :id => "add-#{u dashboard.name}" %>
<%= link_to active.name, {:controller => :dashboard, :action => :index, :id => active.dashboard_id, :resource => params[:resource]} -%> + <%= link_to active.name, {:controller => :dashboard, :action => :index, :id => active.dashboard_id, :resource => params[:resource]} -%> + <% if active.dashboard.description.present? %> +

<%= h active.dashboard.description -%>

+ <% end %> +
<%= boolean_icon(active.dashboard.shared, {:display_false => false}) -%> -- 2.39.5