+ Deletion Confirmation

This commit is contained in:
Daniel Legt 2022-06-03 22:59:44 +03:00
parent d056a4d429
commit faff1ab527
2 changed files with 16 additions and 2 deletions

View File

@ -63,6 +63,10 @@ func AdminRoutes(router *gin.RouterGroup) {
}) })
router.GET("/delete/:padname", func(ctx *gin.Context) {
})
// Admin view route // Admin view route
router.GET("/view", func(ctx *gin.Context) { router.GET("/view", func(ctx *gin.Context) {

View File

@ -58,9 +58,9 @@
{{ $element.LastModified }} {{ $element.LastModified }}
</div> </div>
<div class="col-2"> <div class="col-2">
<a href="#" class="btn btn-danger"> <div onclick="doDelete(`{{ $element.Name }}`)" class="btn btn-danger">
Delete Delete
</a> </div>
</div> </div>
</div> </div>
@ -75,4 +75,14 @@
{{ template "inc/theme-toggle.html" .}} {{ template "inc/theme-toggle.html" .}}
</body> </body>
<script>
function doDelete(id) {
// Confirm deletion
if ( confirm("Confirm pad deletion?") ) {
// Do delete
window.location.href = `/admin/delete/${id}`;
}
}
</script>
{{ template "inc/footer.html" .}} {{ template "inc/footer.html" .}}