Module: Foundationize::ViewHelpers
- Defined in:
- lib/foundationize/foundationize_viewhelpers.rb
Instance Method Summary collapse
- #dropdown_menu(url, text, options = {}, &block) ⇒ Object
- #foundationize_flash ⇒ Object
- #left_section(&block) ⇒ Object
- #menu_divider(hide = false) ⇒ Object
- #menu_item(url, text, options = {}) ⇒ Object
- #menu_label(text) ⇒ Object
- #right_section(&block) ⇒ Object
- #top_bar(options = {}, &block) ⇒ Object
- #top_bar_section(direction, &block) ⇒ Object
Instance Method Details
#dropdown_menu(url, text, options = {}, &block) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 62 def (url, text, ={}, &block) html = "" content_tag :li, class: [:active] ? "has-dropdown active" : "has-dropdown" do html += link_to(url,text) content = capture(&block) html += content_tag :ul, content, class: "dropdown" raw html end end |
#foundationize_flash ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 5 def foundationize_flash = [] flash.each do |type, | next if .blank? type = :alert if type == :error type = :success if type == :success type = :secondary if type == :notice Array().each do |msg| flash = raw("<div data-alert class=\"alert-box #{type}\">#{msg.html_safe}<a href=\"#\" class=\"close\">×</a></div>"); << flash if msg end end .join("\n").html_safe end |
#left_section(&block) ⇒ Object
37 38 39 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 37 def left_section(&block) ("left", &block) end |
#menu_divider(hide = false) ⇒ Object
72 73 74 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 72 def (hide = false) content_tag :li, nil, class: hide ? "divider hide-for-small" : "divider" end |
#menu_item(url, text, options = {}) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 51 def (url, text, ={}) html = "" html += if [:divider] html += content_tag :li, link_to(url,text), class: [:active] ? "active" : "" raw html end |
#menu_label(text) ⇒ Object
58 59 60 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 58 def (text) content_tag :li, content_tag(:label,text) end |
#right_section(&block) ⇒ Object
41 42 43 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 41 def right_section(&block) ("right", &block) end |
#top_bar(options = {}, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 23 def (={}, &block) content_tag :nav, class: "top-bar" do content = "" content += content_tag :li, content_tag(:h1, link_to([:title],"#")), class: "name" content += content_tag :li, link_to([:text], "#"), class: [:icon] ? "toggle-topbar menu-icon" : "toggle-topbar" html = content_tag :ul, raw(content), class: "title-area" content = capture(&block) html +=content_tag :section, content, class: "top-bar-section" raw html end end |
#top_bar_section(direction, &block) ⇒ Object
45 46 47 48 49 |
# File 'lib/foundationize/foundationize_viewhelpers.rb', line 45 def (direction, &block) content_tag :ul, class: direction do yield end end |