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

#configure, #initialize, #inspect, #options

Instance Method Details

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

Register a global after action



105
106
107
# File 'lib/trestle/configuration.rb', line 105

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

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

Register a global around action



113
114
115
# File 'lib/trestle/configuration.rb', line 113

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

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

Register a global before action



97
98
99
# File 'lib/trestle/configuration.rb', line 97

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

#form_field(name, klass) ⇒ Object

Register a custom form field class



73
74
75
# File 'lib/trestle/configuration.rb', line 73

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

#helper(*helpers, &block) ⇒ Object

Register global helpers available to all Trestle admins



55
56
57
58
# File 'lib/trestle/configuration.rb', line 55

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

#hook(name, &block) ⇒ Object

Register an extension hook



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

def hook(name, &block)
  hooks[name.to_s] << block
end

Register a global navigation menu block



41
42
43
# File 'lib/trestle/configuration.rb', line 41

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