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

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bs_badge.rb,
card/tmpsets/set/mod022-card-mod-bootstrap/abstract/bs_badge.rb

Instance Method Summary collapse

Instance Method Details

#badge_haml_opts(count, label, opts) ⇒ Object



17
18
19
20
21
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/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],
    title: opts[:title] }
end

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



9
10
11
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/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



23
24
25
26
27
28
# File 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bs_badge.rb', line 23

def process_badge_opts count, opts
  if count.try(: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 'card/tmpsets/set/mod021-card-mod-bootstrap/abstract/bs_badge.rb', line 13

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