.
This commit is contained in:
@@ -21,40 +21,10 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#delete-selected-button").on("click", function () {
|
$("#delete-selected-button").on("click", () => {
|
||||||
answer_ids = [];
|
window.delete_multiple(
|
||||||
$("tbody input:checked").each((n, el) => {
|
"{% url 'anatomy:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||||
answer_ids.push(el.value);
|
)
|
||||||
})
|
|
||||||
|
|
||||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'anatomy:user_answer_delete_multiple' %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.status == "success") {
|
|
||||||
toastr.info('Deleted.')
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
toastr.info('Error deleting questions.')
|
|
||||||
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,40 +21,10 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#delete-selected-button").on("click", function () {
|
$("#delete-selected-button").on("click", () => {
|
||||||
answer_ids = [];
|
window.delete_multiple(
|
||||||
$("tbody input:checked").each((n, el) => {
|
"{% url 'rapids:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||||
answer_ids.push(el.value);
|
)
|
||||||
})
|
|
||||||
|
|
||||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'rapids:user_answer_delete_multiple' %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.status == "success") {
|
|
||||||
toastr.info('Deleted.')
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
toastr.info('Error deleting questions.')
|
|
||||||
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,40 +21,10 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#delete-selected-button").on("click", function () {
|
$("#delete-selected-button").on("click", () => {
|
||||||
answer_ids = [];
|
window.delete_multiple(
|
||||||
$("tbody input:checked").each((n, el) => {
|
"{% url 'sbas:user_answer_delete_multiple' %}", "{{ csrf_token }}"
|
||||||
answer_ids.push(el.value);
|
)
|
||||||
})
|
|
||||||
|
|
||||||
if (confirm(`Delete ${answer_ids.length} answers?`)) {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'sbas:user_answer_delete_multiple' %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
answer_ids: JSON.stringify(answer_ids) // true if checked else false
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.status == "success") {
|
|
||||||
toastr.info('Deleted.')
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
toastr.info('Error deleting questions.')
|
|
||||||
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user