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
 | 
			
		||||
	router.GET("/view", func(ctx *gin.Context) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,9 +58,9 @@
 | 
			
		|||
                                {{ $element.LastModified }}
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="col-2">
 | 
			
		||||
                                <a href="#" class="btn btn-danger">
 | 
			
		||||
                                <div onclick="doDelete(`{{ $element.Name }}`)" class="btn btn-danger">
 | 
			
		||||
                                    Delete
 | 
			
		||||
                                </a>
 | 
			
		||||
                                </div>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -75,4 +75,14 @@
 | 
			
		|||
    {{ template "inc/theme-toggle.html" .}}
 | 
			
		||||
</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" .}}
 | 
			
		||||
		Loading…
	
		Reference in New Issue