-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of generating html code for each modal that asks for deleting an attribute only one modal is created. Arguments for the modal are passed with "data-*" attributes. Adapt feature test accordingly.
- Loading branch information
Showing
3 changed files
with
17 additions
and
9 deletions.
There are no files selected for viewing
15 changes: 12 additions & 3 deletions
15
src/api/app/views/webui2/webui/attribute/_delete_dialog.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
.modal.fade{ id: "delete-attribute-modal-#{attribute.id}", tabindex: -1, role: 'dialog', aria: { labelledby: 'delete-modal-label', hidden: true } } | ||
.modal.fade{ id: 'delete-attribute-modal', tabindex: -1, role: 'dialog', aria: { labelledby: 'delete-modal-label', hidden: true } } | ||
.modal-dialog.modal-dialog-centered{ role: 'document' } | ||
.modal-content | ||
.modal-header | ||
%h5.modal-title | ||
Delete attribute? | ||
.modal-body | ||
%p Please confirm deletion of attribute #{attribute.fullname} | ||
= form_tag(attrib_path(attribute), method: :delete) do | ||
%p | ||
Please confirm deletion of attribute | ||
%span#fullname | ||
= form_tag(nil, method: :delete) do | ||
.modal-footer | ||
%a.btn.btn-sm.btn-outline-secondary.px-4{ data: { dismiss: 'modal' } } | ||
Cancel | ||
= submit_tag('Delete', class: 'btn btn-sm btn-danger px-4') | ||
= content_for :ready_function do | ||
:plain | ||
$('#delete-attribute-modal').on('show.bs.modal', function (event) { | ||
var link = $(event.relatedTarget); | ||
$(this).find('#fullname').text(link.data('fullname')); | ||
$(this).find('form').attr('action', link.data('action')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters