-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
document.addEventListener("DOMContentLoaded", function() { | ||
$('#siae_activity_delete_modal').on('show.bs.modal', function (event) { | ||
// Button that triggered the modal | ||
var button = $(event.relatedTarget); | ||
|
||
// Extract info from data-* attributes | ||
var siaeId = button.data('siae-id'); | ||
var siaeSlug = button.data('siae-slug'); | ||
var siaeActivityId = button.data('siae-activity-id'); | ||
var siaeActivityNameDisplay = button.data('siae-activity-name-display'); | ||
console.log(siaeId, siaeSlug, siaeActivityId, siaeActivityNameDisplay) | ||
|
||
// Update the modal's content | ||
// - siae name display | ||
// - edit the form action url | ||
var modal = document.querySelector('#siae_activity_delete_modal'); | ||
var modalForm = modal.querySelector('form'); | ||
if (modal.querySelector('#siae-activity-name-display')) { | ||
modal.querySelector('#siae-activity-name-display').textContent = siaeActivityNameDisplay; | ||
} | ||
var formActionUrl = modalForm.getAttribute('action'); | ||
modalForm.setAttribute('action', formActionUrl.replace('siae-slug-to-replace', siaeSlug).replace('siae-activity-id-to-replace', siaeActivityId)); | ||
}); | ||
}); |
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
23 changes: 23 additions & 0 deletions
23
lemarche/templates/dashboard/_siae_activity_delete_modal.html
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="modal fade modal-siae" id="siae_activity_delete_modal" tabindex="-1" role="dialog" aria-modal="true" data-backdrop="static" data-keyboard="false" aria-labelledby="modalTitle"> | ||
<div class="modal-dialog modal-dialog-centered"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h3 class="modal-title" id="modalTitle">Supprimer</h3> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Fermer"> | ||
<i class="ri-close-line"></i> | ||
</button> | ||
</div> | ||
<form method="POST" action="{% url 'dashboard_siaes:siae_edit_activities_delete' siae.slug|default:'siae-slug-to-replace' activity.id|default:'siae-activity-id-to-replace' %}"> | ||
{% csrf_token %} | ||
<div class="modal-body home-content-body"> | ||
<p class="font-weight-bold">Voulez-vous supprimer cette activité ?</p> | ||
<i><span id="siae-activity-name-display"></span></i> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-sm btn-outline-primary" type="button" data-dismiss="modal" aria-label="Fermer">Annuler</button> | ||
<button class="btn btn-sm btn-primary" type="submit">Confirmer</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> |
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
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