Class: AdminController

Inherits:
ApplicationController
  • Object
show all
Includes:
LoginSystem, Radiant::LegacyRoutes
Defined in:
app/controllers/admin_controller.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LoginSystem

included

Instance Attribute Details

#pagination_parametersObject (readonly)

Returns the value of attribute pagination_parameters.



16
17
18
# File 'app/controllers/admin_controller.rb', line 16

def pagination_parameters
  @pagination_parameters
end

Class Method Details

.controller_permissionsObject



96
97
98
# File 'app/controllers/admin_controller.rb', line 96

def controller_permissions
  @controller_permissions ||= Hash.new { |h,k| h[k.to_s.intern] = Hash.new }
end

.only_allow_access_to(*args) ⇒ Object

TODO MOVE



86
87
88
89
90
91
92
93
94
# File 'app/controllers/admin_controller.rb', line 86

def only_allow_access_to(*args)
  options = {}
  options = args.pop.dup if args.last.kind_of?(Hash)
  options.symbolize_keys!
  actions = args.map { |a| a.to_s.intern }
  actions.each do |action|
    controller_permissions[action] = options
  end
end

Instance Method Details

#include_javascript(script) ⇒ Object



29
30
31
# File 'app/controllers/admin_controller.rb', line 29

def include_javascript(script)
  @javascripts << script
end

#include_stylesheet(sheet) ⇒ Object



25
26
27
# File 'app/controllers/admin_controller.rb', line 25

def include_stylesheet(sheet)
  @stylesheets << sheet
end

#rescue_action_in_public(exception) ⇒ Object



50
51
52
53
54
55
56
57
# File 'app/controllers/admin_controller.rb', line 50

def rescue_action_in_public(exception)
  case exception
    when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
      render :template => "site/not_found", :status => 404
    else
      super
  end
end

#template_nameObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/admin_controller.rb', line 33

def template_name
  case self.action_name
  when 'index'
    'index'
  when 'new','create'
    'new'
  when 'show'
    'show'
  when 'edit', 'update'
    'edit'
  when 'remove', 'destroy'
    'remove'
  else
    self.action_name
  end
end