Module: Spurs::Section::Helper

Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/spurs/section/helper.rb

Instance Method Summary collapse

Instance Method Details

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



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spurs/section/helper.rb', line 6

def spurs_collapsible_section(title,options={},&block)
  opts = Spurs::Section::collapsible_section_default_options.merge(options)
  if !opts[:builder]
    raise "Null builder"
  end

  options_to_pass_to_builder = {}
  builder = opts[:builder].new(options_to_pass_to_builder)
  section_content = capture(nil,&block)
  builder.build_collapsible_section(title.html_safe,section_content.html_safe)
end

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



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/spurs/section/helper.rb', line 18

def spurs_section(title,options={},&block)
  opts = Spurs::Section::section_default_options.merge(options)
  if !opts[:builder]
    raise "Null builder"
  end

  options_to_pass_to_builder = {}
  builder = opts[:builder].new(options_to_pass_to_builder)
  section_content = capture(nil,&block)
  builder.build_section(title.html_safe,section_content.html_safe)
end

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



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/spurs/section/helper.rb', line 30

def spurs_vcenter(options={}, &block)
  opts = options.clone
  if !opts[:class]
    opts[:class] = ""
  end
  opts[:class] = "vcenter_outer ".concat(opts[:class])

  # extract inner options
  inner_opts = opts[:inner_html] ? opts.delete(:inner_html) : {}
  if !inner_opts[:class]
    inner_opts[:class] = ""
  end
  inner_opts[:class].concat(" inner")

  section_content = capture(nil,&block)
  (:div,(:div, (:div,section_content,inner_opts),:class => "middle"),opts)
end