module RailsBootstrapEasyNavbar::NavbarHelper

Constants

DEFAULT_BRAND_PATH
DEFAULT_NAVBAR_CLASS

Public Instance Methods

create_collapsible_navbar(current_tab, nav_items, options={}) click to toggle source
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 11
def create_collapsible_navbar(current_tab, nav_items, options={})
        options[:navbar_class] ||= DEFAULT_NAVBAR_CLASS
        options[:navbar_collapsible] = true
        content_tag(:div, navbar_inner(current_tab, nav_items, options), class: options[:navbar_class])
end
create_navbar(current_tab, nav_items, options={}) click to toggle source
# File lib/rails_bootstrap_easy_navbar/navbar_helper.rb, line 6
def create_navbar(current_tab, nav_items, options={})
        options[:navbar_class] ||= DEFAULT_NAVBAR_CLASS
        content_tag(:div, navbar_inner(current_tab, nav_items, options), class: options[:navbar_class])
end

Private Instance Methods

drop_down_tab(title, items) click to toggle source

Creates HTML for a dropdown list of clickable items

dropdown_title(title) click to toggle source
navbar_inner(current_tab, nav_items, options={}) click to toggle source

Creates the navbar wrapper optionally containing a brand on the left hand side

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