Class: Interview::Dropdown
- Includes:
- HasHtmlOptions
- Defined in:
- lib/interview/controls/dropdown.rb
Instance Attribute Summary collapse
-
#caption ⇒ Object
Returns the value of attribute caption.
-
#container_tag ⇒ Object
Returns the value of attribute container_tag.
-
#image ⇒ Object
Returns the value of attribute image.
-
#style ⇒ Object
Returns the value of attribute style.
Attributes included from HasHtmlOptions
Attributes inherited from Control
Instance Method Summary collapse
Methods included from HasHtmlOptions
Methods inherited from Control
#ancestors, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults
Instance Attribute Details
#caption ⇒ Object
Returns the value of attribute caption.
6 7 8 |
# File 'lib/interview/controls/dropdown.rb', line 6 def @caption end |
#container_tag ⇒ Object
Returns the value of attribute container_tag.
6 7 8 |
# File 'lib/interview/controls/dropdown.rb', line 6 def container_tag @container_tag end |
#image ⇒ Object
Returns the value of attribute image.
6 7 8 |
# File 'lib/interview/controls/dropdown.rb', line 6 def image @image end |
#style ⇒ Object
Returns the value of attribute style.
6 7 8 |
# File 'lib/interview/controls/dropdown.rb', line 6 def style @style end |
Instance Method Details
#build(b) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/interview/controls/dropdown.rb', line 8 def build(b) container_tag = @container_tag || 'div' html_class = @html_class.dup html_class << 'dropdown' b.section style: container_tag, html_class: html_class, html_options: @html_options do html_class = %w(dropdown-toggle) html_class += %w(btn btn-default) if @style == 'button' b.link image: @image, caption: @caption, url: '#', html_class: html_class, html_options: { data: { toggle: 'dropdown' } } do b.space if @image or @caption b.glyphicon image: 'caret' end b.section style: 'ul', html_class: 'dropdown-menu' do b. pointer: self do yield if block_given? end end end end |
#build_child(b, control, &block) ⇒ Object
28 29 30 31 32 |
# File 'lib/interview/controls/dropdown.rb', line 28 def build_child(b, control, &block) b.section style: 'li' do super end end |