Module: Card::Set::All::FormButtons::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb
Instance Method Summary collapse
-
#delete_button(opts = {}) ⇒ Object
-
#delete_button_opts(opts = {}) ⇒ Object
-
#delete_confirm(opts) ⇒ Object
-
#delete_success(opts) ⇒ Object
-
#edit_cancel_button ⇒ Object
-
#modal_cancel_button ⇒ Object
-
#new_cancel_button ⇒ Object
-
#standard_cancel_button(args = {}) ⇒ Object
-
#standard_save_and_close_button(opts = {}) ⇒ Object
-
#standard_save_button(opts = {}) ⇒ String
Generates a standard save button with optional parameters.
-
#standard_submit_button ⇒ Object
Instance Method Details
#delete_button(opts = {}) ⇒ Object
60 61 62 63 64 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 60 def opts={} return unless card.real? link_to "Delete", (opts) end |
#delete_button_opts(opts = {}) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 66 def opts={} add_class opts, "slotter btn btn-outline-danger ms-auto" opts["data-confirm"] = delete_confirm opts opts[:path] = { action: :delete } opts[:path][:success] = delete_success(opts) opts[:remote] = true opts end |
#delete_confirm(opts) ⇒ Object
75 76 77 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 75 def delete_confirm opts opts.delete(:confirm) || "Are you sure you want to delete #{safe_name}?" end |
#delete_success(opts) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 79 def delete_success opts if opts[:success] opts.delete :success elsif main? { redirect: true, mark: "*previous" } else { view: :just_deleted } end end |
#edit_cancel_button ⇒ Object
52 53 54 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 52 def end |
#modal_cancel_button ⇒ Object
48 49 50 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 48 def "Cancel", situation: "secondary", class: "cancel-button" end |
#new_cancel_button ⇒ Object
56 57 58 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 56 def voo.show?(:cancel_button) && end |
#standard_cancel_button(args = {}) ⇒ Object
43 44 45 46 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 43 def args={} args.reverse_merge! class: "cancel-button ms-4", href: path, "data-cy": "cancel" args end |
#standard_save_and_close_button(opts = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 33 def opts={} close = opts.delete(:close) || :modal text = opts[:text] || "Save and Close" add_class opts, "submit-button me-3 _close-on-success" add_class opts, "_update-origin" unless opts[:no_origin_update] opts.reverse_merge! text: text, "data-cy": "submit-#{close}" opts end |
#standard_save_button(opts = {}) ⇒ String
Generates a standard save button with optional parameters.
22 23 24 25 26 27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 22 def opts={} return if voo&.hide?(:save_button) add_class opts, "submit-button me-3 _update-history-pills" opts[:text] ||= "Save" opts["data-cy"] = "save" opts end |
#standard_submit_button ⇒ Object
9 10 11 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/form_buttons.rb', line 9 def output [, ] end |