Module: BootstrapHelper

Defined in:
lib/trap/helpers/bootstrap_helper.rb

Instance Method Summary collapse

Instance Method Details



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/trap/helpers/bootstrap_helper.rb', line 11

def dropdown(text, icon = nil, &block)
   :li, class: :drowdown do
    concat(link_to('#', class: 'dropdown-toggle', data: { toggle: :dropdown }) do
	if icon
 concat icon_element icon
 concat ' '
	end
	concat text
	unless icon
 concat ' '
 concat  :span, '', class: :caret
	end
    end)
    concat((:ul, class: 'dropdown-menu') do
	yield block
    end)
  end
end

#icon_element(name) ⇒ Object



30
31
32
# File 'lib/trap/helpers/bootstrap_helper.rb', line 30

def icon_element(name)
   :span, '', class: "glyphicon glyphicon-#{name}"
end


2
3
4
5
6
7
8
9
# File 'lib/trap/helpers/bootstrap_helper.rb', line 2

def menu_item(name = nil, path = '#', *args, &block)
  path = name || path if block_given?
  options = args.extract_options!
   :li, class: is_active?(path, options) do
    name, path = path, options if block_given?
    link_to name, path, options, &block
  end
end