mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
feat: Enhance file deletion UX with custom confirmation dialogs
- Add FileMetadataDialog component for consistent delete confirmation - Implement custom JavaScript handlers for file deletion events - Add Notyf notifications for successful and failed deletions - Improve delete button behavior in file list, details, and search views - Enhance error handling and user feedback during file metadata deletion
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -344,6 +345,8 @@ func (h *FileMetadataHandler) SearchFileMetadata(c *gin.Context) {
|
||||
func (h *FileMetadataHandler) DeleteFileMetadata(c *gin.Context) {
|
||||
userID := c.GetUint("userID")
|
||||
|
||||
fmt.Println("Deleting file metadata")
|
||||
|
||||
// Get file ID from URL parameter
|
||||
fileID, err := strconv.ParseUint(c.Param("id"), 10, 64)
|
||||
if err != nil {
|
||||
@@ -373,6 +376,16 @@ func (h *FileMetadataHandler) DeleteFileMetadata(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Redirect to the file list
|
||||
c.Redirect(http.StatusFound, "/files")
|
||||
fmt.Println("File deleted successfully")
|
||||
|
||||
// Check if this is an HTMX request
|
||||
isHtmxRequest := c.GetHeader("HX-Request") == "true"
|
||||
|
||||
if isHtmxRequest {
|
||||
// For HTMX requests, just return a 200 status - client will handle UI updates
|
||||
c.Status(http.StatusOK)
|
||||
} else {
|
||||
// For regular browser requests, redirect to the file list
|
||||
c.Redirect(http.StatusFound, "/files")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user