-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add delete functionality for indicators (#498)
- Loading branch information
1 parent
b1f9c5b
commit 9c71d6f
Showing
6 changed files
with
83 additions
and
19 deletions.
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
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
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,12 +1,68 @@ | ||
{% extends "base.html" %} | ||
{% block page_title %}Indicator Confirm Delete{% endblock %} | ||
<div | ||
class="modal fade" | ||
id="deleteIndicatorModal{{indicator.id}}" | ||
tabindex="-1" | ||
role="dialog" | ||
aria-labelledby="deleteItemModalLabel" | ||
> | ||
<div class="modal-dialog" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title" id="deleteIndicatorLabel">Confirm Delete</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p> | ||
Are you sure you want to delete "<strong>{{ indicator.name }}"</strong>? | ||
</p> | ||
<div class="text-right"> | ||
<button | ||
type="submit" | ||
class="btn btn-close" | ||
onclick="deleteCancel()"> | ||
Cancel | ||
</button> | ||
<button | ||
type="submit" | ||
class="btn btn-danger" | ||
onclick="deleteItem()" | ||
id="deleteItem{{ indicator.id }}" | ||
> | ||
Delete | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% block content %} | ||
<script> | ||
var itemId; | ||
var activeButton; | ||
/** | ||
* Set the Item to delete | ||
**/ | ||
function setItemToDelete(id) { | ||
itemId = id; | ||
} | ||
|
||
<form action="" method="post">{% csrf_token %} | ||
<p>Are you sure you want to delete?</p> | ||
<input type="submit" value="Confirm" /> | ||
</form> | ||
/** | ||
* Redirect to the page to delete the item | ||
**/ | ||
function deleteItem() { | ||
toastr.success('You have successfully delete the indicator'); | ||
setTimeout(() => { | ||
window.location.href = `/indicators/indicator_delete/${itemId}/`; | ||
}, 2000); | ||
} | ||
|
||
|
||
{% endblock content %} | ||
/** | ||
* reload the page to close the modal | ||
**/ | ||
function deleteCancel() { | ||
window.location.reload(); | ||
} | ||
$(document).ready(() => {}); | ||
</script> |
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