aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-05-11 19:02:43 +0200
committerDavid Gageot <david@gageot.net>2012-05-11 19:03:53 +0200
commitf7620138aef29ea13c65fd2d3dae8b43bd0b2037 (patch)
tree01e96483a278bd58be822a9380defeb97352b82e
parent3c74ec8a349158067972d892fd03662dbb51094a (diff)
downloadsonarqube-f7620138aef29ea13c65fd2d3dae8b43bd0b2037.tar.gz
sonarqube-f7620138aef29ea13c65fd2d3dae8b43bd0b2037.zip
FIX remove redirection from home to dashboard
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb13
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/home_controller.rb30
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/config/routes.rb4
3 files changed, 8 insertions, 39 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
index d01a2bd464c..5cd31a3d311 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
@@ -31,16 +31,11 @@ class DashboardController < ApplicationController
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
@@ -155,8 +150,10 @@ class DashboardController < ApplicationController
@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
@@ -166,8 +163,10 @@ class DashboardController < ApplicationController
@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)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/home_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/home_controller.rb
deleted file mode 100644
index f65ceae9257..00000000000
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/home_controller.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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
diff --git a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
index b56bdf7d233..2c304042b0c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
@@ -33,8 +33,8 @@ ActionController::Routing::Routes.draw do |map|
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 => /.*/ }