Sha256: 48f0f965165f30edb0b6ddaab7b940808f7a227526840938bc8dcaa7bd6ed8d4

Contents?: true

Size: 1.18 KB

Versions: 16

Compression:

Stored size: 1.18 KB

Contents

format :html do
  # Options
  # @param opts [Hash]
  # @option opts [String, Hash<name, href>] brand
  # @option opts [String] class
  # @option opts [Boolean] no_collapse
  # @option opts [:left, :right] toggle_align
  def navbar id, opts={}, &block
    nav_opts = opts[:navbar_opts] || {}
    nav_opts[:class] ||= opts[:class]
    add_class nav_opts,
              "navbar navbar-dark bg-#{opts.delete(:navbar_type) || 'primary'}"
    navbar_content id, opts, nav_opts, &block
  end

  private

  def navbar_content id, opts, nav_opts
    content = yield
    if opts[:no_collapse]
      navbar_nocollapse content, nav_opts
    else
      navbar_responsive id, content, opts, nav_opts
    end
  end

  def navbar_nocollapse content, nav_opts
    # content = wrap_with(:div, content)
    wrap_with :nav, content, nav_opts
  end

  def navbar_responsive id, content, opts, nav_opts
    opts[:toggle_align] ||= :right
    wrap_with :nav, nav_opts do
      haml :navbar_responsive, id: id, content: content, opts: opts
    end
  end

  def breadcrumb items
    wrap_with :ol, class: "breadcrumb" do
      items.map do |item|
        wrap_with :li, item, class: "breadcrumb-item"
      end.join
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.14.2 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.14.1 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.14.0 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.13.4 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.13.3 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.13.2 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.13.1 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.13.0 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.7 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.12.0 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.6 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.5 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.4 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.3 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.2 set/all/bootstrap/navbar.rb
card-mod-bootstrap-0.11.1 set/all/bootstrap/navbar.rb