Class: Trestle::Configuration

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/trestle/configuration.rb

Defined Under Namespace

Classes: Action

Instance Method Summary collapse

Methods included from Configurable

#as_json, #assign, #configure, #fetch, #inspect, #options

Instance Method Details

#after_action(options = {}, &block) ⇒ Object

Register a global after action



131
132
133
# File 'lib/trestle/configuration.rb', line 131

def after_action(options={}, &block)
  after_actions << Action.new(options, block)
end

#around_action(options = {}, &block) ⇒ Object

Register a global around action



139
140
141
# File 'lib/trestle/configuration.rb', line 139

def around_action(options={}, &block)
  around_actions << Action.new(options, block)
end

#before_action(options = {}, &block) ⇒ Object

Register a global before action



123
124
125
# File 'lib/trestle/configuration.rb', line 123

def before_action(options={}, &block)
  before_actions << Action.new(options, block)
end

#form_field(name, klass) ⇒ Object

Register a custom form field class



82
83
84
# File 'lib/trestle/configuration.rb', line 82

def form_field(name, klass)
  Form::Builder.register(name, klass)
end

#helper(*helpers, &block) ⇒ Object

Register global helpers available to all Trestle admins



64
65
66
67
# File 'lib/trestle/configuration.rb', line 64

def helper(*helpers, &block)
  self.helpers += helpers
  self.helper_module.module_eval(&block) if block_given?
end

#hook(name, options = {}, &block) ⇒ Object

Register an extension hook



90
91
92
# File 'lib/trestle/configuration.rb', line 90

def hook(name, options={}, &block)
  hooks.append(name, options, &block)
end

Register a global navigation menu block



50
51
52
# File 'lib/trestle/configuration.rb', line 50

def menu(&block)
  menus << Navigation::Block.new(&block)
end