class Bh::Classes::Dropdown

Private Class Methods

aligns() click to toggle source

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

append to a dropdown to left- or right- align to the toggle button.
# File lib/bh/classes/dropdown.rb, line 49
def self.aligns
  HashWithIndifferentAccess.new.tap do |klass|
    klass[:right] = :'dropdown-menu-right'
  end
end
directions() click to toggle source

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

append to a dropdown to show a drop-"up" or -"down".
# File lib/bh/classes/dropdown.rb, line 41
def self.directions
  HashWithIndifferentAccess.new.tap do |klass|
    klass[:up] = :dropup
  end
end
groupables() click to toggle source

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

append to a dropdown to display it as inline or block.
# File lib/bh/classes/dropdown.rb, line 33
def self.groupables
  HashWithIndifferentAccess.new(:'btn-group').tap do |klass|
    klass[false] = :dropdown
  end
end

Public Instance Methods

align_class() click to toggle source

@return [#to_s] the align-related class to assign to the dropdown.

# File lib/bh/classes/dropdown.rb, line 17
def align_class
  Dropdown.aligns[@options[:align]]
end
direction_class() click to toggle source

@return [#to_s] the direction-related class to assign to the dropdown.

# File lib/bh/classes/dropdown.rb, line 12
def direction_class
  Dropdown.directions[@options[:direction]]
end
groupable_class() click to toggle source

@return [#to_s] the group-related class to assign to the dropdown.

# File lib/bh/classes/dropdown.rb, line 7
def groupable_class
  Dropdown.groupables[@options[:groupable]]
end
id() click to toggle source
# File lib/bh/classes/dropdown.rb, line 21
def id
  @options.fetch :id, "dropdown-#{rand 10**10}"
end
partial() click to toggle source
# File lib/bh/classes/dropdown.rb, line 25
def partial
  @options[:split] ? 'dropdown_split' : 'dropdown'
end