Module: Card::Set::All::Bootstrap::Helper::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb

Instance Method Summary collapse

Instance Method Details

#badge_tag(content, options = {}) ⇒ Object



43
44
45
46
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 43

def badge_tag content, options={}
  add_class options, "badge"
  wrap_with :span, content, options
end


9
10
11
12
13
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 9

def button_link link_text, opts={}
  btn_type = opts.delete(:btn_type) || "primary"
  opts[:class] = [opts[:class], "btn btn-#{btn_type}"].compact.join " "
  smart_link_to link_text, opts
end

#list_group(content_or_options = nil, options = {}) ⇒ Object



19
20
21
22
23
24
25
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 19

def list_group content_or_options=nil, options={}
  options = content_or_options if block_given?
  content = block_given? ? yield : content_or_options
  content = Array(content).map(&:to_s)
  add_list_group_classes options
  list_tag content, options
end

#list_item_tags(content, default_item_options) ⇒ Object



35
36
37
38
39
40
41
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 35

def list_item_tags content, default_item_options
  content.map do |item|
    i_content, i_opts = item
    i_opts ||= default_item_options
    wrap_with :li, i_content, i_opts
  end
end

#list_tag(content_or_options = nil, options = {}, &block) ⇒ Object



27
28
29
30
31
32
33
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 27

def list_tag content_or_options=nil, options={}, &block
  content, options = list_tag_content_and_options content_or_options, options, &block
  default_item_options = options.delete(:items) || {}
  wrap_with (options[:ordered] ? :ol : :ul), options do
    list_item_tags content, default_item_options
  end
end


48
49
50
51
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 48

def popover_link text, title=nil, link_text=nil, opts={}
  link_text ||= icon_tag :help
  link_to link_text, popover_opts(text, title, opts)
end

#popover_opts(text, title, opts) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 53

def popover_opts text, title, opts
  add_class opts, "ps-1 _popover_link"
  text = " " unless text.present?
  opts.reverse_merge! path: "#",
                      tabindex: 0,
                      data: { "bs-toggle": "popover",
                              "bs-trigger": "hover focus",
                              # "bs-container": ".modal.show",
                              "bs-content": text }
  opts["data-bs-title"] = title if title
  opts
end

#separatorObject



15
16
17
# File 'platypus/tmp/set/gem-defaults/mod024-bootstrap/all/bootstrap/helper.rb', line 15

def separator
  '<li role="separator" class="divider"></li>'
end