Class: NavbarHelper::Dropdown

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/navbar_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#chosenObject

Returns the value of attribute chosen.



177
178
179
# File 'app/helpers/navbar_helper.rb', line 177

def chosen
  @chosen
end

#parentObject

Returns the value of attribute parent.



177
178
179
# File 'app/helpers/navbar_helper.rb', line 177

def parent
  @parent
end

Instance Method Details

#dividerObject



201
202
203
# File 'app/helpers/navbar_helper.rb', line 201

def divider
	 :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, options={})
	menu_item_options = options.dup
	menu_item_options[:class] = parse_html_classes_to_arr menu_item_options[:class]

	state = uri_state uri

	if state == :active || state == :chosen
		menu_item_options[:class] << 'active'
		@chosen = true
	end

	content = link_to text, uri
	 :li, content, menu_item_options
end