Sha256: 4d1748dac3572a6e8f7ab7b87b92fa40dad62610ff89bf6da419287dea3974cf

Contents?: true

Size: 1.84 KB

Versions: 4

Compression:

Stored size: 1.84 KB

Contents

=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by Owen Peredo Diaz
  Email: owenperedo@gmail.com
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program 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 Affero General Public License (GPLv3) for more details.
=end
class AdminController < CamaleonController
  rescue_from CanCan::AccessDenied do |exception|
    flash[:error] = "Error: #{exception.message}"
    redirect_to admin_dashboard_path
  end
  include Admin::ApplicationHelper

  layout "admin"
  before_action :authenticate
  before_action :admin_init_actions
  before_action :admin_logged_actions
  before_action :admin_before_hooks
  after_action :admin_after_hooks
  # layout Proc.new { |controller| request.headers["X-XHR-Referer"] ? "admin/_ajax" : 'admin' }

  # render admin dashboard
  def index
  end

  # render admin dashboard
  def dashboard
    render "admin/dashboard/index"
  end

  private
  # initialize all vars and methods for admin panel
  def admin_init_actions
    I18n.locale = current_site.get_admin_language
    @_admin_menus = {}
    @_admin_breadcrumb = []
    @_extra_models_for_fields = []
    # self.append_view_path(Rails.root.join("app", "apps"))
  end

  # trigger hooks for admin panel before admin load
  def admin_before_hooks
    hooks_run("admin_before_load")
  end

  # trigger hooks for admin panel after admin load
  def admin_after_hooks
    hooks_run("admin_after_load")
  end

  def admin_logged_actions
    admin_menus_add_commons unless request.xhr?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
camaleon_cms-1.0.3 app/controllers/admin_controller.rb
camaleon_cms-1.0.2 app/controllers/admin_controller.rb
camaleon_cms-1.0.1 app/controllers/admin_controller.rb
camaleon_cms-1.0 app/controllers/admin_controller.rb