Sha256: 829759cd68f89eae0c58d42647028d797a3584efc7c005c5cc7bb66678af22ba
Contents?: true
Size: 865 Bytes
Versions: 4
Compression:
Stored size: 865 Bytes
Contents
module Dashing class DashboardsController < ApplicationController before_filter :check_dashboard_name, only: :show rescue_from ActionView::MissingTemplate, with: :template_not_found def index render file: dashboard_path(Dashing.config.default_dashboard || Dashing.first_dashboard || ''), layout: Dashing.config.dashboard_layout end def show render file: dashboard_path(params[:name]), layout: Dashing.config.dashboard_layout end private def check_dashboard_name raise 'bad dashboard name' unless params[:name] =~ /\A[a-zA-z0-9_\-]+\z/ end def dashboard_path(name) Rails.root.join(Dashing.config.dashboards_path, name) end def template_not_found raise "Count not find template for dashboard '#{params[:name]}'. Define your dashboard in #{dashboard_path('')}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems