module BootstrapNavbar::Helpers::Bootstrap4
Public Instance Methods
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