class Bh::Classes::AlertBox

Private Class Methods

contexts() click to toggle source

@return [Hash<Symbol, String>] the class that Bootstrap requires to

append to an alert box based on its context.
# File lib/bh/classes/alert_box.rb, line 23
def self.contexts
  HashWithIndifferentAccess.new(:'alert-info').tap do |klass|
    klass[:alert]   = :'alert-danger'
    klass[:danger]  = :'alert-danger'
    klass[:info]    = :'alert-info'
    klass[:notice]  = :'alert-success'
    klass[:success] = :'alert-success'
    klass[:warning] = :'alert-warning'
  end
end

Public Instance Methods

context_class() click to toggle source

@return [#to_s] the content-related class to assign to the alert box.

# File lib/bh/classes/alert_box.rb, line 7
def context_class
  AlertBox.contexts[@options.fetch :context, @options[:priority]]
end
dismissible_button() click to toggle source

@return [#to_s] the HTML to show a dismissible button for the alert box.

# File lib/bh/classes/alert_box.rb, line 12
def dismissible_button
  if @options[:dismissible] || @options[:priority]
    path = '../../views/bh/_alert_dismiss_button.html'
    File.read File.expand_path(path, __FILE__)
  end
end