class Bh::Classes::Button

Private Class Methods

contexts() click to toggle source

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

append to buttons for each possible context.
# File lib/bh/classes/button.rb, line 25
def self.contexts
  HashWithIndifferentAccess.new(:'btn-default').tap do |klass|
    klass[:danger]  = :'btn-danger'
    klass[:info]    = :'btn-info'
    klass[:link]    = :'btn-link'
    klass[:primary] = :'btn-primary'
    klass[:success] = :'btn-success'
    klass[:warning] = :'btn-warning'
  end
end
layouts() click to toggle source

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

append to buttons for each possible layout.
# File lib/bh/classes/button.rb, line 51
def self.layouts
  HashWithIndifferentAccess.new.tap do |klass|
    klass[:block] = :'btn-block'
  end
end
sizes() click to toggle source

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

append to buttons for each possible size.
# File lib/bh/classes/button.rb, line 38
def self.sizes
  HashWithIndifferentAccess.new.tap do |klass|
    klass[:extra_small] = :'btn-xs'
    klass[:large]       = :'btn-lg'
    klass[:lg]          = :'btn-lg'
    klass[:sm]          = :'btn-sm'
    klass[:small]       = :'btn-sm'
    klass[:xs]          = :'btn-xs'
  end
end

Public Instance Methods

context_class() click to toggle source

@return [#to_s] the context-related class to assign to the button.

# File lib/bh/classes/button.rb, line 7
def context_class
  Button.contexts[@options[:context]]
end
layout_class() click to toggle source

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

# File lib/bh/classes/button.rb, line 17
def layout_class
  Button.layouts[@options[:layout]]
end
size_class() click to toggle source

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

# File lib/bh/classes/button.rb, line 12
def size_class
  Button.sizes[@options[:size]]
end