Module: BootstrapHelper
- Defined in:
- lib/trap/helpers/bootstrap_helper.rb
Instance Method Summary collapse
- #dropdown(text, icon = nil, &block) ⇒ Object
- #icon_element(name) ⇒ Object
- #menu_item(name = nil, path = '#', *args, &block) ⇒ Object
Instance Method Details
#dropdown(text, icon = nil, &block) ⇒ Object
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) content_tag :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 content_tag :span, '', class: :caret end end) concat(content_tag(: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) content_tag :span, '', class: "glyphicon glyphicon-#{name}" end |
#menu_item(name = nil, path = '#', *args, &block) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/trap/helpers/bootstrap_helper.rb', line 2 def (name = nil, path = '#', *args, &block) path = name || path if block_given? = args. content_tag :li, class: is_active?(path, ) do name, path = path, if block_given? link_to name, path, , &block end end |