Stimulus controller to delete record

This commit is contained in:
2024-11-06 22:02:56 +01:00
parent 4e52ea48f6
commit 36185d0539
4 changed files with 133 additions and 79 deletions

View File

@@ -3,7 +3,7 @@
{% block title %}Collector - {{ record.name }} | ArCOA{% endblock %}
{% block rightpanel %}
<div class="container" style="max-width: 60vw">
<div class="container" style="max-width: 60vw" data-controller="delete-record">
<h1 class="is-size-1 mt-0 has-text-centered">Collector</h1>
<h2 class="is-size-3 mt-3 has-text-centered">{{ record.name }}</h2>
@@ -33,12 +33,14 @@
<i class="fa fa-copy"></i>
</span>
</button>
<button class="button is-danger">
<a href=""
class="button is-danger"
data-delete-record-target="path" data-action="click->delete-record#show">
Delete
<span class="icon ml-2">
<i class="fa fa-trash"></i>
</span>
</button>
</a>
</div>
</div>
{% endif %}
@@ -83,7 +85,28 @@
</table>
{% endif %}
</div>
</div>
</div>
<div class="modal" data-delete-record-target="modal">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<span class="icon is-large has-text-warning">
<i class="fa fa-warning fa-2x"></i>
</span>
<p class="modal-card-title has-text-danger pl-2"><strong>Delete record?</strong></p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
<p class="is-size-5">This record will be permanently deleted. Proceed?</p>
</section>
<footer class="modal-card-foot">
<div class="buttons is-right">
<button class="button is-link" data-action="click->delete-record#delete">Confirm</button>
<button class="button is-light" id="cancel">Cancel</button>
</div>
</footer>
</div>
</div>
</div>
<script type="text/javascript" defer></script>
{% endblock %}