class Bh::Classes::Navbar
Private Class Methods
layouts()
click to toggle source
@return [Hash<Symbol, String>] the classes that Bootstrap requires to
append to the navbar container for each possible layout.
# File lib/bh/classes/navbar.rb, line 62 def self.layouts HashWithIndifferentAccess.new(:'container').tap do |klass| klass[true] = :'container-fluid' end end
positions()
click to toggle source
@return [Hash<Symbol, String>] the classes that Bootstrap requires to
append to navbars to set a specific DOM position.
# File lib/bh/classes/navbar.rb, line 49 def self.positions HashWithIndifferentAccess.new.tap do |klass| klass[:static] = :'navbar-static-top' klass[:static_top] = :'navbar-static-top' klass[:top] = :'navbar-fixed-top' klass[:fixed_top] = :'navbar-fixed-top' klass[:bottom] = :'navbar-fixed-bottom' klass[:fixed_bottom] = :'navbar-fixed-bottom' end end
styles()
click to toggle source
@return [Hash<Symbol, String>] the classes that Bootstrap requires to
append to navbars to specify a color combination.
# File lib/bh/classes/navbar.rb, line 41 def self.styles HashWithIndifferentAccess.new(:'navbar-default').tap do |klass| klass[true] = :'navbar-inverse' end end
Public Instance Methods
body_padding_style()
click to toggle source
@private The fixed navbar will overlay your other content, unless you add padding to the top or bottom of the <body>. Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high. @see getbootstrap.com/components/#navbar-fixed-top
# File lib/bh/classes/navbar.rb, line 30 def body_padding_style if body_padding_amount && body_padding_type style = "padding-#{body_padding_type}: #{body_padding_amount}px" @app.content_tag :style, "body {#{style}}" end end
id()
click to toggle source
# File lib/bh/classes/navbar.rb, line 21 def id @id ||= @options.fetch :id, "navbar-collapse-#{rand 10**10}" end
layout_class()
click to toggle source
@return [#to_s] the layout-related class to assign to the navbar.
# File lib/bh/classes/navbar.rb, line 17 def layout_class Navbar.layouts[@options[:fluid]] end
position_class()
click to toggle source
@return [#to_s] the position-related class to assign to the navbar.
# File lib/bh/classes/navbar.rb, line 12 def position_class Navbar.positions[@options[:position]] end
style_class()
click to toggle source
@return [#to_s] the style-related class to assign to the navbar.
# File lib/bh/classes/navbar.rb, line 7 def style_class Navbar.styles[@options[:inverted]] end
Private Instance Methods
body_padding_amount()
click to toggle source
# File lib/bh/classes/navbar.rb, line 68 def body_padding_amount @options.fetch :padding, 70 end
body_padding_type()
click to toggle source
# File lib/bh/classes/navbar.rb, line 72 def body_padding_type /navbar-fixed-(?<type>top|bottom)$/ =~ position_class type end