Module: Card::Set::All::FormButtons::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- tmpsets/set/mod023-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
- #standard_cancel_button(args = {}) ⇒ Object
- #standard_save_and_close_button(opts = {}) ⇒ Object
- #standard_save_button(opts = {}) ⇒ Object
- #standard_submit_button ⇒ Object
Instance Method Details
#delete_button(opts = {}) ⇒ Object
43 44 45 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 43 def opts={} link_to "Delete", (opts) end |
#delete_button_opts(opts = {}) ⇒ Object
47 48 49 50 51 52 53 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 47 def opts={} add_class opts, "slotter btn btn-outline-danger ml-auto btn-sm" opts["data-confirm"] = delete_confirm opts opts[:path] = { action: :delete, success: delete_success(opts) } opts[:remote] = true opts end |
#delete_confirm(opts) ⇒ Object
55 56 57 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 55 def delete_confirm opts opts.delete(:confirm) || "Are you sure you want to delete #{safe_name}?" end |
#delete_success(opts) ⇒ Object
59 60 61 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 59 def delete_success opts opts.delete(:success) || (main? ? "REDIRECT: *previous" : { view: :just_deleted }) end |
#edit_cancel_button ⇒ Object
39 40 41 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 39 def "Cancel", situation: "secondary", class: "btn-sm" end |
#standard_cancel_button(args = {}) ⇒ Object
34 35 36 37 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 34 def args={} args.reverse_merge! class: "cancel-button ml-4", href: path, "data-cy": "cancel" args end |
#standard_save_and_close_button(opts = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 24 def opts={} close = opts.delete(:close) || :modal text = opts[:text] || "Save and Close" add_class opts, "submit-button btn-sm mr-3 _close-#{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 = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 13 def opts={} return if voo&.hide?(:save_button) add_class opts, "submit-button btn-sm mr-3" opts[:text] ||= "Save" opts["data-cy"] = "save" opts end |
#standard_submit_button ⇒ Object
9 10 11 |
# File 'tmpsets/set/mod023-edit/all/form_buttons.rb', line 9 def output [, ] end |