Module: Card::Set::All::Modal::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb
Constant Summary collapse
- MODAL_SIZE =
{ small: "sm", medium: nil, large: "lg", full: "full", xl: "xl" }.freeze
- MODAL_CLOSE_OPTS =
{ type: "button", "data-bs-dismiss": "modal", "data-cy": "close-modal" }.freeze
Instance Method Summary collapse
-
#add_modal_size_class(classes, size) ⇒ Object
-
#modal_close_button(link_text = "Close", opts = {}) ⇒ Object
-
#modal_dialog_classes(opts) ⇒ Object
-
#modal_link(text = nil, opts = {}) ⇒ Object
-
#modal_link_opts(opts) ⇒ Object
-
#modal_submit_button(opts = {}) ⇒ Object
-
#normalize_modal_size_class(size) ⇒ Object
-
#show_in_modal_link(link_text, body) ⇒ Object
-
#view: close_modal_link ⇒ Object
-
#view: modal ⇒ Object
-
#view: modal_footer ⇒ Object
-
#view: modal_link ⇒ Object
-
#view: modal_menu ⇒ Object
-
#view: modal_title ⇒ Object
-
#view: pop_out_modal_link ⇒ Object
Instance Method Details
#add_modal_size_class(classes, size) ⇒ Object
97 98 99 100 101 102 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 97 def add_modal_size_class classes, size size = normalize_modal_size_class size return if size == :medium || size.blank? classes << "modal-#{MODAL_SIZE[size]}" end |
#modal_close_button(link_text = "Close", opts = {}) ⇒ Object
61 62 63 64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 61 def link_text="Close", opts={} classes = opts.delete(:class) = opts.merge(MODAL_CLOSE_OPTS) add_class , classes if classes link_text, end |
#modal_dialog_classes(opts) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 88 def modal_dialog_classes opts classes = [classy("modal-dialog"), "modal-dialog-centered"] return classes unless opts.present? add_modal_size_class classes, opts[:size] # classes << "modal-dialog-centered" if opts[:vertically_centered] classes.join " " end |
#modal_link(text = nil, opts = {}) ⇒ Object
73 74 75 76 77 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 73 def modal_link text=nil, opts={} opts = modal_link_opts(opts) opts[:path][:layout] ||= :modal link_to text, opts end |
#modal_link_opts(opts) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 79 def modal_link_opts opts add_class opts, "slotter" opts.reverse_merge! path: {}, "data-slotter-mode": "modal", "data-modal-class": modal_dialog_classes(opts), remote: true opts end |
#modal_submit_button(opts = {}) ⇒ Object
68 69 70 71 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 68 def opts={} add_class opts, "submit-button _close-modal" opts end |
#normalize_modal_size_class(size) ⇒ Object
104 105 106 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 104 def normalize_modal_size_class size size.in?(MODAL_SIZE.keys) ? size : cast_modal_option(size) end |
#show_in_modal_link(link_text, body) ⇒ Object
57 58 59 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 57 def show_in_modal_link link_text, body link_to_view :modal, link_text, "data-modal-body": body, "data-slotter-mode": "modal" end |
#view: close_modal_link ⇒ Object
47 48 49 50 51 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 47 view :close_modal_link, unknown: true do link_to icon_tag(:close), path: "", class: "_close-modal btn-close", "data-bs-dismiss": "modal" end |
#view: modal ⇒ Object
22 23 24 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 22 view :modal, wrap: :modal do "" end |
#view: modal_footer ⇒ Object
37 38 39 40 41 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 37 view :modal_footer, unknown: true do "Close", class: "btn-xs _close-modal float-end", "data-bs-dismiss" => "modal" end |
#view: modal_link ⇒ Object
43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 43 view :modal_link do modal_link _render_title, size: voo.size end |
#view: modal_menu ⇒ Object
26 27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 26 view :modal_menu, unknown: true, wrap: :modal_menu do [render_close_modal_link, render_pop_out_modal_link(optional: :show)] end |
#view: modal_title ⇒ Object
33 34 35 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 33 view :modal_title, unknown: true do "" end |
#view: pop_out_modal_link ⇒ Object
53 54 55 |
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/modal.rb', line 53 view :pop_out_modal_link, unknown: :blank do link_to icon_tag(:modal), path: {}, class: "pop-out-modal btn-close" end |