Class: DropdownHelper::Dropdown

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
app/helpers/dropdown_helper.rb

Instance Method Summary collapse

Instance Method Details

#divider(options = {}) ⇒ Object



36
37
38
39
40
41
42
# File 'app/helpers/dropdown_helper.rb', line 36

def divider(options={})
	classes = parse_html_classes_to_arr options[:class]
	classes << 'divider'
	divider_options = options.dup
	divider_options[:class] = classes
	 :li, '', divider_options
end

#header(text, options = {}) ⇒ Object



44
45
46
47
48
49
50
51
# File 'app/helpers/dropdown_helper.rb', line 44

def header(text, options={})
	header_options = options.dup
	classes = parse_html_classes_to_arr header_options[:class]
	classes << 'dropdown-header'
	header_options[:class] = classes

	 :li, text, header_options
end

#item(text, link_or_options = nil, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/dropdown_helper.rb', line 25

def item(text, link_or_options=nil, options={})
	if link_or_options.is_a? Hash
		link_or_options, options = nil, link_or_options
	end

	link_or_options ||= '#'

	content =  :a, text, href: link_or_options
	 :li, content, options
end