2015-06-10 03:59:39 -04:00
|
|
|
# RootController
|
|
|
|
#
|
|
|
|
# This controller exists solely to handle requests to `root_url`. When a user is
|
|
|
|
# logged in and has customized their `dashboard` setting, they will be
|
|
|
|
# redirected to their preferred location.
|
|
|
|
#
|
|
|
|
# For users who haven't customized the setting, we simply delegate to
|
|
|
|
# `DashboardController#show`, which is the default.
|
|
|
|
class RootController < DashboardController
|
2015-06-12 20:53:58 -04:00
|
|
|
before_action :redirect_to_custom_dashboard, only: [:show]
|
|
|
|
|
2015-06-10 03:59:39 -04:00
|
|
|
def show
|
2015-06-12 20:53:58 -04:00
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def redirect_to_custom_dashboard
|
|
|
|
return unless current_user
|
|
|
|
|
|
|
|
case current_user.dashboard
|
2015-06-10 03:59:39 -04:00
|
|
|
when 'stars'
|
|
|
|
redirect_to starred_dashboard_projects_path
|
|
|
|
else
|
2015-06-12 20:53:58 -04:00
|
|
|
return
|
2015-06-10 03:59:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|