Module: Oasis::Layout

Defined in:
lib/oasis/layout.rb

Overview

This module makes it easier for developers to centralize the process they use for defining engine, and engine action specific layouts. Primarily, this strategy works really nicely with class/controller re-opening in the master Rails application.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



8
9
10
# File 'lib/oasis/layout.rb', line 8

def self.extended(base)
  base.send :include, InstanceMethods
end

Instance Method Details

#layout_for(name, layout_path = nil, &blk) ⇒ Object

this is the public api endpoint for controller definitions. layout_path should be either a String, Symbol, or false. optionally, you can pass a proc to this method and it will evaluate as if it were sent a symbol.



39
40
41
42
43
44
45
# File 'lib/oasis/layout.rb', line 39

def layout_for(name, layout_path = nil, &blk)
  name = name.to_sym
  write_inheritable_hash(:layouts, :default => predefined_layout) unless predefined_layout == :compute_oasis_layouts
  context = block_given? ? blk : layout_path
  write_inheritable_hash(:layouts, name => context)
  layout(:compute_oasis_layouts)
end

#layoutsObject

simple accessor to the layouts defined by Oasis/#layout_for



48
49
50
# File 'lib/oasis/layout.rb', line 48

def layouts
  self.read_inheritable_attribute(:layouts)
end