Module: Card::Set::All::EditName::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb,
card/tmpsets/set/mod011-card-mod-edit/all/edit_name.rb

Instance Method Summary collapse

Instance Method Details

#edit_name_buttonsObject



41
42
43
44
45
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 41

def edit_name_buttons
  button_formgroup do
    [rename_and_update_button, rename_button, standard_cancel_button]
  end
end

#edit_name_confirmationObject



47
48
49
50
51
# File 'card/tmpsets/set/mod011-card-mod-edit/all/edit_name.rb', line 47

def edit_name_confirmation
  alert "warning", false, false, class: "hidden-alert" do
    haml :edit_name_confirmation, referer_count: card.references_in.count
  end
end

#edit_name_hidden_fieldsObject



36
37
38
# File 'card/tmpsets/set/mod011-card-mod-edit/all/edit_name.rb', line 36

def edit_name_hidden_fields
  hidden_tags old_name: card.name, card: { update_referers: false }
end

#edit_name_success(view = nil) ⇒ Object



31
32
33
34
35
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 31

def edit_name_success view=nil
  success = { id: "_self" }
  success[:view] = view if view
  success
end

#hidden_edit_name_fieldsObject



37
38
39
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 37

def hidden_edit_name_fields
  hidden_tags old_name: card.name, card: { update_referers: false }
end

#name_form(success_view = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 19

def 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,
     edit_name_buttons]
  end
end

#rename_and_update_buttonObject

LOCALIZE



48
49
50
51
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 48

def rename_and_update_button
  submit_button text: "Rename and Update", disable_with: "Renaming",
                class: "renamer-updater"
end

#rename_buttonObject



53
54
55
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 53

def rename_button
  button_tag "Rename", data: { disable_with: "Renaming" }, class: "renamer"
end

#rename_confirmation_alertObject

LOCALIZE



58
59
60
61
62
63
64
# File 'card/tmpsets/set/mod012-card-mod-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 << %(<h6>This may change names referred to by other cards.</h6>)
  msg << %(<p>You may choose to <em>update or ignore</em> the referers.</p>)
  msg << hidden_field_tag(:referers, 1)
  alert("warning", false, false, class: "hidden-alert") { msg }
end

#view: edit_nameObject

note: depends on js with selector “.edit_name-view .card-form”



10
11
12
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 10

view :edit_name, perms: :update do
  frame { name_form }
end

#view: name_formObject

note: depends on js with selector “.name_form-view .card-form”



15
16
17
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_name.rb', line 15

view :name_form, perms: :update, wrap: :slot, cache: :never do
  name_form :edit_name_row
end