Module: Card::Set::All::Board::BoardPills::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb

Constant Summary collapse

BOARD_PILL_UL_CLASSES =
"nav nav-pills _auto-single-select board-pills flex-column".freeze
BOARD_PILL_LI_CLASSES =
"nav-item".freeze

Instance Method Summary collapse

Instance Method Details

#board_pill_item_opts(breadcrumb, extra_opts, text) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb', line 28

def board_pill_item_opts breadcrumb, extra_opts, text
  opts = board_link_opts.merge("data-bs-toggle": "pill")
  opts.merge! breadcrumb_data(breadcrumb)

  if extra_opts
    classes = extra_opts.delete :class
    add_class opts, classes if classes
    opts.deep_merge! extra_opts
  end
  opts["data-cy"] = "#{text.to_name.key}-pill"
  add_class opts, "nav-link"
  opts
end

#board_pill_items(data, breadcrumb) ⇒ Object



20
21
22
23
24
25
26
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb', line 20

def board_pill_items data, breadcrumb
  data.map do |text, field, extra_opts|
    opts = board_pill_item_opts breadcrumb, extra_opts, text
    mark = opts.delete(:mark) == :absolute ? field : [card, field]
    link_to_card mark, text, opts
  end
end

#board_pill_section(tab_name, title, items) ⇒ Object



48
49
50
51
52
53
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb', line 48

def board_pill_section tab_name, title, items
  wrap_with(:h6, title, class: "ms-1 mt-3") +
    wrap_each_with(:li, class: BOARD_PILL_LI_CLASSES) do
      board_pill_items(items, tab_name)
    end.html_safe
end

#board_pill_sections(tab_name) ⇒ Object



42
43
44
45
46
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb', line 42

def board_pill_sections tab_name
  wrap_with :ul, class: BOARD_PILL_UL_CLASSES do
    yield.map { |args| board_pill_section(tab_name, *args) }
  end
end

#board_pills(items) ⇒ Object



14
15
16
17
18
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/board/board_pills.rb', line 14

def board_pills items
  list_tag class: BOARD_PILL_UL_CLASSES, items: { class: BOARD_PILL_LI_CLASSES } do
    items
  end
end