mirror of https://github.com/JustKato/FreePad.git
+ Deletion Confirmation
This commit is contained in:
parent
d056a4d429
commit
faff1ab527
|
@ -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) {
|
||||||
|
|
||||||
|
|
|
@ -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" .}}
|
Loading…
Reference in New Issue