Class: Dashboards::DashboardsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/dashboards/dashboards_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

caches_action :show, expires_in: -> { Dashboards.configuration.cache_duration }



5
6
7
8
9
10
11
12
# File 'app/controllers/dashboards/dashboards_controller.rb', line 5

def index
  if Dashboards.configuration.dashboards.empty?
    render :no_dashboards
  else
    first_dashboard = Dashboards.configuration.dashboards.first
    redirect_to dashboard_path(first_dashboard.slug)
  end
end

#showObject



14
15
16
17
18
19
# File 'app/controllers/dashboards/dashboards_controller.rb', line 14

def show
  @dashboard = Dashboards.configuration.find_dashboard(params[:dashboard])
  if @dashboard.nil?
    redirect_to root_path, alert: "Dashboard not found"
  end
end