Module: Card::Set::All::Bridge::BridgePills::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod011-edit/all/bridge/bridge_pills.rb
Constant Summary collapse
- BRIDGE_PILL_UL_CLASSES =
"nav nav-pills _auto-single-select bridge-pills flex-column".freeze
- BRIDGE_PILL_LI_CLASSES =
"nav-item".freeze
Instance Method Summary collapse
-
#bridge_pill_item_opts(breadcrumb, extra_opts, text) ⇒ Object
-
#bridge_pill_items(data, breadcrumb) ⇒ Object
-
#bridge_pill_section(tab_name, title, items) ⇒ Object
-
#bridge_pill_sections(tab_name) ⇒ Object
-
#bridge_pills(items) ⇒ Object
Instance Method Details
#bridge_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/bridge/bridge_pills.rb', line 28 def bridge_pill_item_opts , extra_opts, text opts = bridge_link_opts.merge("data-bs-toggle": "pill") opts.merge! () 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 |
#bridge_pill_items(data, breadcrumb) ⇒ Object
20 21 22 23 24 25 26 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/bridge/bridge_pills.rb', line 20 def bridge_pill_items data, data.map do |text, field, extra_opts| opts = bridge_pill_item_opts , extra_opts, text mark = opts.delete(:mark) == :absolute ? field : [card, field] link_to_card mark, text, opts end end |
#bridge_pill_section(tab_name, title, items) ⇒ Object
48 49 50 51 52 53 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/bridge/bridge_pills.rb', line 48 def bridge_pill_section tab_name, title, items wrap_with(:h6, title, class: "ms-1 mt-3") + wrap_each_with(:li, class: BRIDGE_PILL_LI_CLASSES) do bridge_pill_items(items, tab_name) end.html_safe end |
#bridge_pill_sections(tab_name) ⇒ Object
42 43 44 45 46 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/bridge/bridge_pills.rb', line 42 def bridge_pill_sections tab_name wrap_with :ul, class: BRIDGE_PILL_UL_CLASSES do yield.map { |args| bridge_pill_section(tab_name, *args) } end end |
#bridge_pills(items) ⇒ Object
14 15 16 17 18 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/bridge/bridge_pills.rb', line 14 def bridge_pills items list_tag class: BRIDGE_PILL_UL_CLASSES, items: { class: BRIDGE_PILL_LI_CLASSES } do items end end |