Sha256: 4bd1f3d0d9b63f0fe28392d75b292382d3271b8e93d546fc745998fd4e3151bf

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'railsstrap/classes/navbar'
require 'railsstrap/classes/vertical'

module Railsstrap
  module Helpers
    # Displays the non-collapsable portion of a Bootstrap-styled navbar.
    # @see http://getbootstrap.com/components/docs/4.0/navbar
    # @return [String] the HTML to display the non-collapsable portion of a
    #   Bootstrap-styled navbar.
    # @overload vertical(content, options = {})
    #   @param [#to_s] content the non-collapsable content to display in the
    #     navbar.
    #   @param [Hash] options the options to pass to the wrapping `<div>`.
    # @overload vertical(options = {}, &block)
    #   @param [Hash] options the options to pass to the wrapping `<div>`.
    #   @yieldreturn [#to_s] the non-collapsable content to display in the
    #     navbar.
    # @example Display a navbar a non-collapsable links.
    #   navbar do
    #     vertical do
    #       link_to 'Home', '/'
    #     end
    #   end
    def vertical(*args, &block)
      navbar = Railsstrap::Stack.find(Railsstrap::Navbar)
      if navbar
        vertical = Railsstrap::Vertical.new self, *args, &block
        vertical.append_class! :'navbar-header'
        vertical.prepend_html! vertical.toggle_button(navbar.id)
        vertical.render_tag :div
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 lib/railsstrap/helpers/vertical_helper.rb
railsstrap-4.0.0.beta2 lib/railsstrap/helpers/vertical_helper.rb