]> source.dussan.org Git - sonarqube.git/commitdiff
FIX remove redirection from home to dashboard
authorDavid Gageot <david@gageot.net>
Fri, 11 May 2012 17:02:43 +0000 (19:02 +0200)
committerDavid Gageot <david@gageot.net>
Fri, 11 May 2012 17:03:53 +0000 (19:03 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/home_controller.rb [deleted file]
sonar-server/src/main/webapp/WEB-INF/config/routes.rb

index d01a2bd464c6aa87d65b81e802b4597969d73811..5cd31a3d311a097646ee36d8be2244d08922dff9 100644 (file)
@@ -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 (file)
index f65ceae..0000000
+++ /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
index b56bdf7d233ec85ba076ea2be479abab99f3d199..2c304042b0c480090f8dd0b25ab6923fada4e845 100644 (file)
@@ -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 => /.*/ }