Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Adds confirm popup when removing letters of support #652

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/views/form/support_letters/_support_letter.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ li.view-only
mount_name: :attachment
span.clear

= button_to "Remove", form_form_answer_support_letter_path(@form_answer, support_letter), method: :delete, class: "govuk-button govuk-button--warning #{'read_only' if admin_in_read_only_mode?}", 'aria-label' => "Delete support letter from #{support_letter.first_name} #{support_letter.last_name}"
= button_to "Remove", form_form_answer_support_letter_path(@form_answer, support_letter),
data: { method: :delete, confirm: 'Are you sure you want to delete this letter of support?' },
class: "govuk-button govuk-button--warning #{'read_only' if admin_in_read_only_mode?}",
'aria-label' => "Delete support letter from #{support_letter.first_name} #{support_letter.last_name}"
4 changes: 2 additions & 2 deletions app/views/qae_form/_supporter_fields.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ li.js-add-example class="#{'read-only js-support-letter-received' if persisted}"
- else
- url = "#"
- if current_user || policy(:support_letter).can_remove?
= link_to "Remove", url, class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link", data: { url: url }, 'aria-label' => "Delete support letter from #{supporter["first_name"]} #{supporter["last_name"]}"
= link_to "Remove", url, class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link", data: { confirm: 'Are you sure you want to delete this letter of support?', url: url }, 'aria-label' => "Delete support letter from #{supporter["first_name"]} #{supporter["last_name"]}"
- else
= link_to "Remove", "#", class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link govuk-!-display-none", data: { url: "#" }, 'aria-label' => "#"
= link_to "Remove", "#", class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link govuk-!-display-none", data: { confirm: 'Are you sure you want to delete this letter of support?', url: "#" }, 'aria-label' => "#"
2 changes: 1 addition & 1 deletion app/views/qae_form/_supporter_fields_placeholder.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ li.js-add-example class="govuk-!-display-none"
button.govuk-button.button-alt.js-save-collection data-save-collection-url=users_form_answer_support_letters_url(@form_answer) disabled='disabled'
| Submit letter of support

= link_to "Remove", "#", class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link govuk-!-display-none", data: { url: "#" }, 'aria-label' => "#"
= link_to "Remove", "#", class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link govuk-!-display-none", data: { confirm: 'Are you sure you want to delete this letter of support?', url: "#" }, 'aria-label' => "#"
Loading