module BootstrapNavbar::Helpers::Bootstrap4

Public Instance Methods

navbar(options = {}, &block) click to toggle source
navbar_collapse(options = {}, &block) click to toggle source
navbar_dropdown(text, list_item_options = {}, link_options = {}, wrapper_options = {}, &block) click to toggle source
navbar_dropdown_divider() click to toggle source
navbar_dropdown_item(text, url = nil, link_options = {}, &block) click to toggle source
navbar_group(options = {}, &block) click to toggle source
navbar_item(text, url = nil, list_item_options = nil, link_options = nil, &block) click to toggle source
navbar_text(text) click to toggle source

Private Instance Methods

container(container, &block) click to toggle source
# File lib/bootstrap-navbar/helpers/bootstrap4.rb, line 135
  def container(container, &block)
    container_class = [
      'container',
      (container unless container == true)
    ].compact.join('-')
    attributes = attributes_for_tag(class: container_class)
    prepare_html <<~HTML
                    <div#{attributes}>
                      #{capture(&block) if block_given?}
                    </div>
                  HTML
  end
wrapper(options, &block) click to toggle source
# File lib/bootstrap-navbar/helpers/bootstrap4.rb, line 148
  def wrapper(options, &block)
    options = options.dup
    options[:class] = [options[:class], 'navbar'].compact
    options[:class] << "navbar-#{options.key?(:color_scheme) ? options.delete(:color_scheme) : 'dark'}"
    if bg = options.delete(:bg)
      options[:class] << "bg-#{bg == true ? 'dark' : bg}"
    end
    if options.key?(:sticky) && options.delete(:sticky) === true
      options[:class] << 'sticky-top'
    elsif options.key?(:placement)
      options[:class] << "fixed-#{options.delete(:placement)}"
    end
    expand_at = options.delete(:expand_at)
    unless expand_at == true
      options[:class] << "navbar-expand#{"-#{expand_at}" if expand_at}"
    end
    options[:class] = options[:class].join(' ')
    attributes = attributes_for_tag(options)
    prepare_html <<~HTML
                    <nav#{attributes}>
                      #{capture(&block) if block_given?}
                    </nav>
                  HTML
  end