Sha256: d068f78adde7b14a3f969e1e423a33e850dfa23a6c65bae149b9371e6cf55569

Contents?: true

Size: 1012 Bytes

Versions: 1

Compression:

Stored size: 1012 Bytes

Contents

require_dependency "faalis/application_controller"

module Faalis
  class DashboardController < ApplicationController

    include Faalis::Dashboard::Controller

    layout "faalis/dashboard"
    before_filter :authenticate_user!, :only => [:modules, :index]

    respond_to :json, :html

    def jstemplate
      if user_signed_in?
        render :template => "angularjs_templates/#{params[:path]}", :layout => nil
      else
        render :login_required_page
      end
    end

    def index
      @jstemplates_path = "/templates"
    end

    def modules
      dashboard_modules = []

      Faalis::Engine.dashboard_modules.each do |module_name, attrs|
        if not attrs.include? :title
          attrs[:title] = _(module_name.to_s)
        end

        if not attrs.include? :resource
          attrs[:resource] = module_name.to_s
        end

        dashboard_modules << attrs
      end
      dashboard_modules = {:modules => dashboard_modules}
      respond_with dashboard_modules
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faalis-0.7.0 app/controllers/faalis/dashboard_controller.rb