Module: Card::Set::All::EditName::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- tmpsets/set/mod023-edit/all/edit_name.rb
Instance Method Summary collapse
- #edit_name_buttons ⇒ Object
- #edit_name_form(success_view = nil) ⇒ Object
- #edit_name_success(view = nil) ⇒ Object
- #format_rename_effects_and_options(effects, referer_option) ⇒ Object
- #hidden_edit_name_fields ⇒ Object
- #rename_and_update_button ⇒ Object
- #rename_button ⇒ Object
- #rename_confirmation_alert ⇒ Object
- #rename_descendant_effect ⇒ Object
- #rename_effects_and_options ⇒ Object
- #rename_referer_effect_and_option ⇒ Object
Instance Method Details
#edit_name_buttons ⇒ Object
43 44 45 46 47 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 43 def do [, , ] end end |
#edit_name_form(success_view = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 21 def edit_name_form success_view=nil card_form({ action: :update, id: card.id }, # "main-success" => "REDIRECT", "data-update-origin": "true", success: edit_name_success(success_view)) do [hidden_edit_name_fields, _render_name_formgroup, rename_confirmation_alert, ] end end |
#edit_name_success(view = nil) ⇒ Object
33 34 35 36 37 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 33 def edit_name_success view=nil success = { id: "_self" } success[:view] = view if view success end |
#format_rename_effects_and_options(effects, referer_option) ⇒ Object
73 74 75 76 77 78 79 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 73 def effects, referer_option effects = effects.map { |effect| "<li>#{effect}</li>" }.join info = %(<h6>This change will...</h6>) info += %(<ul>#{effects}</ul>) info += %(<p>#{referer_option}</p>) if referer_option info end |
#hidden_edit_name_fields ⇒ Object
39 40 41 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 39 def hidden_edit_name_fields old_name: card.name, card: { update_referers: false } end |
#rename_and_update_button ⇒ Object
49 50 51 52 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 49 def text: "Rename and Update", disable_with: "Renaming", class: "renamer-updater" end |
#rename_button ⇒ Object
54 55 56 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 54 def "Rename", data: { disable_with: "Renaming" }, class: "renamer" end |
#rename_confirmation_alert ⇒ Object
58 59 60 61 62 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 58 def rename_confirmation_alert msg = "<h5>Are you sure you want to rename <em>#{safe_name}</em>?</h5>" msg << alert("warning", false, false, class: "hidden-alert") { msg } end |
#rename_descendant_effect ⇒ Object
81 82 83 84 85 86 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 81 def rename_descendant_effect descendants = card.descendants return unless descendants.any? # FIXME: count, don't instantiate "automatically alter #{descendants.size} related name(s)." end |
#rename_effects_and_options ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 64 def descendant_effect = rename_descendant_effect referer_effect, referer_option = rename_referer_effect_and_option effects = [descendant_effect, referer_effect].compact return "" if effects.empty? effects, referer_option end |
#rename_referer_effect_and_option ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'tmpsets/set/mod023-edit/all/edit_name.rb', line 88 def rename_referer_effect_and_option referers = card.family_referers return unless referers.any? # FIXME: count, don't instantiate count = referers.size refs = count == 1 ? "reference" : "references" effect = "affect at least #{count} #{refs} to \"#{card.name}\"" effect += hidden_field_tag(:referers, count) option = "You may choose to <em>update or ignore</em> the referers." [effect, option] end |