Class: Interview::NavigationItem
- Defined in:
- lib/interview/controls/navigation_item.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#badge_formula ⇒ Object
Returns the value of attribute badge_formula.
-
#level ⇒ Object
Returns the value of attribute level.
Attributes inherited from Link
#action, #assoc_object, #caption, #hint, #http_method, #image, #nested_resource, #new_site, #object, #options, #style, #url, #url_params
Attributes included from HasHtmlOptions
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Link
Methods included from HasHtmlOptions
Methods included from NestedBuildable
#create_nested_builder, #render_nested_builder
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::Link
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
4 5 6 |
# File 'lib/interview/controls/navigation_item.rb', line 4 def active @active end |
#badge_formula ⇒ Object
Returns the value of attribute badge_formula.
4 5 6 |
# File 'lib/interview/controls/navigation_item.rb', line 4 def badge_formula @badge_formula end |
#level ⇒ Object
Returns the value of attribute level.
4 5 6 |
# File 'lib/interview/controls/navigation_item.rb', line 4 def level @level end |
Instance Method Details
#build(b) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/interview/controls/navigation_item.rb', line 6 def build(b) set_level html_class = ["level#{@level}"] html_class << 'active' if @active b.section style: 'li', html_class: html_class do super(b) do badge = @badge_formula.call if @badge_formula unless badge.nil? or badge == 0 or badge == '' b.text text: badge.to_s, style: 'span', html_class: 'badge pull-right' end end end yield if block_given? end |