Class: Interview::MediaObject
- Defined in:
- lib/interview/controls/media_object.rb
Instance Attribute Summary
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Control
#ancestors, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Constructor Details
This class inherits a constructor from Interview::Control
Instance Method Details
#build(b) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/interview/controls/media_object.rb', line 4 def build(b) b.section html_class: 'media' do b. pointer: self do @child_no = 0 yield if block_given? end b << '</div>' if @child_no >= 2 end end |
#build_child(b, control, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/interview/controls/media_object.rb', line 14 def build_child(b, control, &block) @child_no += 1 if @child_no == 1 if control.respond_to? :html_class control.html_class = 'pull-left' super else b.section html_class: 'pull-left' do super end end elsif @child_no == 2 b << '<div class="media-body">' control.html_class = 'media-heading' if control.respond_to? :html_class super else super end end |