Class: NavbarHelper::NavbarGroup
- Inherits:
-
Object
- Object
- NavbarHelper::NavbarGroup
- Defined in:
- app/helpers/navbar_helper.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #dropdown(text, options = {}, &block) ⇒ Object
-
#initialize(parent) ⇒ NavbarGroup
constructor
A new instance of NavbarGroup.
- #item(text, uri, options = {}) ⇒ Object
Constructor Details
#initialize(parent) ⇒ NavbarGroup
Returns a new instance of NavbarGroup.
132 133 134 |
# File 'app/helpers/navbar_helper.rb', line 132 def initialize(parent) self.parent = parent end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
130 131 132 |
# File 'app/helpers/navbar_helper.rb', line 130 def parent @parent end |
Instance Method Details
#dropdown(text, options = {}, &block) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'app/helpers/navbar_helper.rb', line 152 def dropdown(text, ={}, &block) dropdown_builder = Dropdown.new self.parent content = [] content << link_to("#{text} #{caret}".html_safe, '#', class: 'dropdown-toggle', data: {toggle: 'dropdown'}) items = capture dropdown_builder, &block content << content_tag(:ul, items, class: 'dropdown-menu') = .dup [:class] = parse_html_classes_to_arr [:class] [:class] << 'dropdown' if dropdown_builder.chosen [:class] << 'active' end content_tag :li, content.join("\n").html_safe, end |
#item(text, uri, options = {}) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'app/helpers/navbar_helper.rb', line 138 def item(text, uri, ={}) = .dup [:class] = parse_html_classes_to_arr [:class] state = uri_state uri if state == :active || state == :chosen [:class] << 'active' end content = link_to text, uri content_tag :li, content, end |