if !@resource || @resource.display_dashboard?
load_dashboard()
load_authorized_widget_definitions()
- unless @dashboard
- redirect_to home_path
- end
elsif @snapshot
# display the layout of the parent, usually the directory, but display the file viewers
@file = @resource
@project = @snapshot.parent.project
render :action => 'no_dashboard'
- else
- redirect_to home_path
end
end
@active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id=?', params[:did].to_i, current_user.id])
elsif params[:name]
@active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id=?', params[:name], current_user.id])
- else
+ elsif params[:id]
@active=ActiveDashboard.user_dashboards(current_user).find { |a| !a.global? }
+ else
+ @active=ActiveDashboard.user_dashboards(current_user).find { |a| a.global? }
end
end
@active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['active_dashboards.dashboard_id=? AND active_dashboards.user_id IS NULL', params[:did].to_i])
elsif params[:name]
@active=ActiveDashboard.find(:first, :include => 'dashboard', :conditions => ['dashboards.name=? AND active_dashboards.user_id IS NULL', params[:name]])
- else
+ elsif params[:id]
@active=ActiveDashboard.user_dashboards(nil).find { |a| !a.global? }
+ else
+ @active=ActiveDashboard.user_dashboards(nil).find { |a| a.global? }
end
end
@dashboard=(@active ? @active.dashboard : nil)
+++ /dev/null
-#
-# Sonar, open source software quality management tool.
-# Copyright (C) 2008-2012 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# Sonar is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# Sonar is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with Sonar; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
-#
-class HomeController < ApplicationController
- def index
- @first__global_dashboard = ActiveDashboard.user_dashboards(current_user).select(&:global?).first
-
- if @first__global_dashboard
- redirect_to :controller => :dashboard, :params => {:did => @first__global_dashboard.dashboard_id }
- else
- redirect_to :controller => :reviews
- end
- end
-end
map.resources 'properties', :path_prefix => 'api', :controller => 'api/properties', :requirements => { :id => /.*/ }
# home page
- map.home '', :controller => :home, :action => :index
- map.root :controller => :home, :action => :index
+ map.home '', :controller => :dashboard, :action => :index
+ map.root :controller => :dashboard, :action => :index
# page plugins
map.connect 'plugins/configuration/:page', :controller => 'plugins/configuration', :action => 'index', :requirements => { :page => /.*/ }