Class: Interview::CollapseContainer

Inherits:
Control
  • Object
show all
Defined in:
lib/interview/controls/collapse_container.rb

Instance Attribute Summary collapse

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Control

#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults

Constructor Details

This class inherits a constructor from Interview::Control

Instance Attribute Details

#captionObject

Returns the value of attribute caption.



4
5
6
# File 'lib/interview/controls/collapse_container.rb', line 4

def caption
  @caption
end

#imageObject

Returns the value of attribute image.



4
5
6
# File 'lib/interview/controls/collapse_container.rb', line 4

def image
  @image
end

Instance Method Details

#build(b) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/interview/controls/collapse_container.rb', line 6

def build(b)
  new_id = Time.now.to_f.to_s.delete('.')
  b.link image: @image, caption: @caption, url: '#', html_class: 'collapse_link',
         html_options: { data: { toogle: 'collapse', target: "##{new_id}" } }
  b.section html_class: 'panel-collapse collapse', html_options: { id: new_id } do
    yield if block_given?
  end
end