Commit 2c24a61a authored by Maik Messerschmidt's avatar Maik Messerschmidt
Browse files

Ask for confirmation before removing results.

parent cdb0a551
* Adds a click-listener to each "confirm-delete" class element.
* When clicked, the form referenced by the elements "data-form-id" value
* will be submitted, after asking for confirmation.
* Take a look at resources/views/results/index.blade.php for better understanding.
document.addEventListener("DOMContentLoaded", () => {
for (const elem of document.getElementsByClassName("confirm-delete")) {
const form = document.getElementById(elem.dataset.formId)
const message = elem.dataset.message
elem.addEventListener("click", event => {
const confirmed = confirm(elem.dataset.message || "Delete?")
if (confirmed)
......@@ -37,8 +37,9 @@
<i class="fa fa-eye"></i><small>json</small>
<a href="_blank" title="Remove these results"
onclick="event.preventDefault(); document.getElementById('remove-form-{{$result->id}}').submit();">
<a href="_blank" class="confirm-delete" title="Remove these results"
data-message="Do you really want to delete this result?">
<i class="fa fa-remove"></i>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment