module RailsBootstrapEasyNavbar::NavbarHelper
Constants
- DEFAULT_BRAND_PATH
- DEFAULT_NAVBAR_CLASS
Public Instance Methods
Private Instance Methods
drop_down_links(items)
click to toggle source
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 70 def drop_down_links(items) items.map do |tab_name, path| content_tag(:li, (link_to tab_name, path)) end.join("").html_safe end
drop_down_tab(title, items)
click to toggle source
Creates HTML for a dropdown list of clickable items
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 64 def drop_down_tab(title, items) [content_tag(:a, dropdown_title(title), href: "#", class: "dropdown-toggle", 'data-toggle' => "dropdown"), content_tag(:ul, drop_down_links(items), class: "dropdown-menu") ].join("").html_safe end
dropdown_title(title)
click to toggle source
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 76 def dropdown_title(title) dropdown_title = (title + " "+content_tag(:b, nil, class: "caret")).html_safe end
separator()
click to toggle source
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 59 def separator content_tag(:li, nil, class: "divider-vertical") end
tabs(current_tab, nav_items)
click to toggle source
Creates HTML for a list of clickable tabs
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 47 def tabs(current_tab, nav_items) nav_items.map do |tab_name, path| if path.is_a? Hash # A Hash here means the tab is made up of multiple links -> dropdown content_tag(:li, drop_down_tab(tab_name, path), class: "dropdown") else # construct and add a link to the list of tabs args = [:li, (link_to tab_name, path)] args << {class: "active"} if tab_name == current_tab content_tag(*args) end end.join(separator).html_safe end