Module: Card::Set::Abstract::BsBadge::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod001-utility/abstract/bs_badge.rb

Instance Method Summary collapse

Instance Method Details

#badge_haml_opts(count, label, opts) ⇒ Object



17
18
19
20
# File 'tmpsets/set/mod001-utility/abstract/bs_badge.rb', line 17

def badge_haml_opts count, label, opts
  process_badge_opts count, opts
  { count: count, label: label, klass: opts[:klass], color: opts[:color] }
end

#labeled_badge(count, label, opts = {}) ⇒ Object



9
10
11
# File 'tmpsets/set/mod001-utility/abstract/bs_badge.rb', line 9

def labeled_badge count, label, opts={}
  haml :labeled_badge, badge_haml_opts(count, label, opts)
end

#process_badge_opts(count, opts) ⇒ Object



22
23
24
25
26
27
# File 'tmpsets/set/mod001-utility/abstract/bs_badge.rb', line 22

def process_badge_opts count, opts
  if count.zero? && !opts[:zero_ok]
    opts[:klass] = [opts[:klass], "disabled-o"].compact.join " "
  end
  opts[:color] ||= "secondary"
end

#tab_badge(count, label, opts = {}) ⇒ Object



13
14
15
# File 'tmpsets/set/mod001-utility/abstract/bs_badge.rb', line 13

def tab_badge count, label, opts={}
  haml :tab_badge, badge_haml_opts(count, label, opts)
end