Class: NavbarHelper::Dropdown
- Inherits:
-
Object
- Object
- NavbarHelper::Dropdown
- Defined in:
- app/helpers/navbar_helper.rb
Instance Attribute Summary collapse
-
#chosen ⇒ Object
Returns the value of attribute chosen.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #divider ⇒ Object
-
#initialize(parent) ⇒ Dropdown
constructor
A new instance of Dropdown.
- #item(text, uri, options = {}) ⇒ Object
Constructor Details
#initialize(parent) ⇒ Dropdown
Returns a new instance of Dropdown.
179 180 181 182 |
# File 'app/helpers/navbar_helper.rb', line 179 def initialize(parent) self.parent = parent @chosen = false end |
Instance Attribute Details
#chosen ⇒ Object
Returns the value of attribute chosen.
177 178 179 |
# File 'app/helpers/navbar_helper.rb', line 177 def chosen @chosen end |
#parent ⇒ Object
Returns the value of attribute parent.
177 178 179 |
# File 'app/helpers/navbar_helper.rb', line 177 def parent @parent end |
Instance Method Details
#divider ⇒ Object
201 202 203 |
# File 'app/helpers/navbar_helper.rb', line 201 def divider content_tag :li, '', class: 'divider' end |
#item(text, uri, options = {}) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'app/helpers/navbar_helper.rb', line 186 def item(text, uri, ={}) = .dup [:class] = parse_html_classes_to_arr [:class] state = uri_state uri if state == :active || state == :chosen [:class] << 'active' @chosen = true end content = link_to text, uri content_tag :li, content, end |