Documentation
¶
Overview ¶
Package files provides the Files feature with nested folder support.
Package files provides the Files feature with nested folder support.
Index ¶
- Variables
- func FileTypeIcon(contentType string) string
- func FormatFileSize(bytes int64) string
- func IsViewable(contentType string) bool
- func Routes(h *Handler, sessionMgr *auth.SessionManager) http.Handler
- type BreadcrumbItem
- type BrowseVM
- type FileFormVM
- type FileInfoModalVM
- type FileManageModalVM
- type FileRow
- type FileUploadVM
- type FolderFormVM
- type FolderInfoModalVM
- type FolderManageModalVM
- type FolderRow
- type Handler
Constants ¶
This section is empty.
Variables ¶
var FS embed.FS
Functions ¶
func FileTypeIcon ¶
FileTypeIcon returns an SVG icon name for a content type.
func FormatFileSize ¶
FormatFileSize formats a file size in bytes to a human-readable string.
func IsViewable ¶
IsViewable returns true if the content type can be displayed inline in a browser.
Types ¶
type BreadcrumbItem ¶
BreadcrumbItem represents an item in the breadcrumb trail.
type BrowseVM ¶
type BrowseVM struct {
viewdata.BaseVM
CurrentFolder *FolderRow
CurrentFolderID string
ParentURL string // URL to go up one level (empty if at root)
Breadcrumbs []BreadcrumbItem
Folders []FolderRow
Files []FileRow
IsAdmin bool
SortBy string
SortOrder string
TypeFilter string
SearchQuery string
TotalFolders int
TotalFiles int
Success string
Error string
}
BrowseVM is the view model for the browse page.
type FileFormVM ¶
type FileFormVM struct {
viewdata.BaseVM
ID string
Name string
Description string
Size string
ContentType string
Error string
}
FileFormVM is the view model for file edit form.
type FileInfoModalVM ¶
type FileInfoModalVM struct {
ID string
Name string
Description string
Size string
ContentType string
TypeIcon string
IsViewable bool
CreatedAt string
UpdatedAt string
}
FileInfoModalVM is the view model for the file info modal.
type FileManageModalVM ¶
type FileManageModalVM struct {
ID string
Name string
Description string
Size string
ContentType string
TypeIcon string
IsViewable bool
BackURL string
CSRFToken string
}
FileManageModalVM is the view model for the file manage modal.
type FileRow ¶
type FileRow struct {
ID string
Name string
Description string
Size string
SizeBytes int64
ContentType string
TypeIcon string
IsViewable bool
CreatedAt string
UpdatedAt string
}
FileRow represents a file in the browse view.
type FileUploadVM ¶
type FileUploadVM struct {
viewdata.BaseVM
FolderID string
FolderName string
Error string
MaxSize string
}
FileUploadVM is the view model for the file upload form.
type FolderFormVM ¶
type FolderFormVM struct {
viewdata.BaseVM
ID string
Name string
Description string
ParentID string
ParentName string
Error string
}
FolderFormVM is the view model for folder new/edit forms.
type FolderInfoModalVM ¶
type FolderInfoModalVM struct {
ID string
Name string
Description string
ItemCount int64
CreatedAt string
UpdatedAt string
}
FolderInfoModalVM is the view model for the folder info modal.
type FolderManageModalVM ¶
type FolderManageModalVM struct {
ID string
Name string
Description string
ItemCount int64
BackURL string
CSRFToken string
}
FolderManageModalVM is the view model for the folder manage modal.
type FolderRow ¶
type FolderRow struct {
ID string
Name string
Description string
ItemCount int64
CreatedAt string
UpdatedAt string
}
FolderRow represents a folder in the browse view.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides file management handlers.
func NewHandler ¶
func NewHandler( db *mongo.Database, fileStorage storage.Store, errLog *errorsfeature.ErrorLogger, auditLogger *auditlog.Logger, logger *zap.Logger, ) *Handler
NewHandler creates a new files Handler.