Module: Rad::Face::ViewHelper

Defined in:
lib/face/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#bObject Also known as: builder



4
5
6
# File 'lib/face/view_helper.rb', line 4

def b
  @b ||= Rad::Face::ViewBuilder.new self
end

#build_layout(layout = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/face/view_helper.rb', line 24

def build_layout layout = nil
  # Configuring
  theme.layout = layout

  # Rendering
  theme.layout_definition['slots'].each do |slot_name, slots|
    slots = Array(slots)
    slots.each do |partial|
      content_for slot_name, render(partial)
    end
  end
end

#themed_partial(partial) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/face/view_helper.rb', line 14

def themed_partial partial
  partial.must =~ /^\//
  themed_partial = "#{rad.face.themes_path}/#{theme.name}#{partial}"
  if rad.template.exist? themed_partial
    themed_partial
  else
    "#{rad.face.themes_path}/default#{partial}"
  end
end

#unique_idObject



9
10
11
12
# File 'lib/face/view_helper.rb', line 9

def unique_id
  @unique_id ||= 0
  @unique_id += 1
end