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

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod026-bootstrap/all/bootstrap/helper.rb

Instance Method Summary collapse

Instance Method Details

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



44
45
46
47
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/helper.rb', line 44

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


9
10
11
12
13
# File 'tmpsets/set/mod026-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
26
27
# File 'tmpsets/set/mod026-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_class options, "list-group"
  options[:items] ||= {}
  add_class options[:items], "list-group-item"
  list_tag content, options
end

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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/helper.rb', line 29

def list_tag content_or_options=nil, options={}
  options = content_or_options if block_given?
  content = block_given? ? yield : content_or_options
  content = Array(content)
  default_item_options = options.delete(:items) || {}
  tag = options[:ordered] ? :ol : :ul
  wrap_with tag, options do
    content.map do |item|
      i_content, i_opts = item
      i_opts ||= default_item_options
      wrap_with :li, i_content, i_opts
    end
  end
end


49
50
51
52
53
54
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/helper.rb', line 49

def popover_link text, title=nil
  opts = { class: "pl-1 text-muted-link", path: "#", "data-toggle": "popover",
           "data-trigger": :focus, "data-content": text }
  opts["data-title"] = title if title
  link_to fa_icon("question-circle"), opts
end

#separatorObject



15
16
17
# File 'tmpsets/set/mod026-bootstrap/all/bootstrap/helper.rb', line 15

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