Class: Interview::Button
- Includes:
- HasHtmlOptions
- Defined in:
- lib/interview/controls/button.rb
Instance Attribute Summary collapse
-
#caption ⇒ Object
Returns the value of attribute caption.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
-
#submit ⇒ Object
Returns the value of attribute submit.
Attributes included from HasHtmlOptions
Attributes inherited from Control
Instance Method Summary collapse
Methods included from HasHtmlOptions
Methods inherited from Control
#ancestors, #build_child, #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/button.rb', line 6 def @caption end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/interview/controls/button.rb', line 6 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
6 7 8 |
# File 'lib/interview/controls/button.rb', line 6 def style @style end |
#submit ⇒ Object
Returns the value of attribute submit.
6 7 8 |
# File 'lib/interview/controls/button.rb', line 6 def submit @submit end |
Instance Method Details
#build(b) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/interview/controls/button.rb', line 8 def build(b) html_class = @html_class.dup if @style.to_s == 'primary' html_class += %w(btn btn-primary) else html_class += %w(btn btn-default) end @html_options[:name] = @name if @submit b << h.submit_tag(@caption, (@html_options, html_class)) else b << h.(@caption, (@html_options, html_class)) end end |