updated layout for small screens - colapsable sidepanel, fix issue with link to favicon when url_prefix is used

This commit is contained in:
2026-04-23 06:49:02 +00:00
parent a30eb4d42d
commit 62bf16589f
7 changed files with 156 additions and 55 deletions
+44 -2
View File
@@ -297,6 +297,7 @@ func (h *Handlers) AdminLogsPage(c *gin.Context) {
c.HTML(http.StatusOK, "admin_logs", gin.H{
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"NoSidebar": true,
"breadcrumbs": []gin.H{{"Name": "/", "URL": "/"}, {"Name": "Admin", "URL": "/editor/admin"}, {"Name": "Logs", "URL": ""}},
"Page": "admin_logs",
@@ -354,6 +355,7 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -370,6 +372,7 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to load profile",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -386,8 +389,8 @@ func (h *Handlers) ProfilePage(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(""),
"Authenticated": true,
"IsAdmin": isAdmin(c),
"Email": email,
"MFAEnabled": mfa.Valid && mfa.String != "",
"LoginAndEdits": h.config.LoginAndEdits,
"Email": email, "MFAEnabled": mfa.Valid && mfa.String != "",
"ContentTemplate": "profile_content",
"ScriptsTemplate": "profile_scripts",
"Page": "profile",
@@ -739,6 +742,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -752,6 +756,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -762,6 +767,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this file",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -777,6 +783,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "File not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested file does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -792,6 +799,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Editing not allowed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This file type cannot be edited here",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -806,6 +814,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read file",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -820,6 +829,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build notes tree",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -843,6 +853,7 @@ func (h *Handlers) EditTextPageHandler(c *gin.Context) {
"notes_tree": notesTree,
"active_path": utils.GetActivePath(folderPath),
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "edit_text_content",
@@ -913,6 +924,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read directory",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -929,6 +941,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -944,6 +957,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -954,6 +968,7 @@ func (h *Handlers) IndexHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this folder",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -989,6 +1004,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1002,6 +1018,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This directory is not accessible",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1015,6 +1032,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1025,6 +1043,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this folder",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1038,6 +1057,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Folder not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1051,6 +1071,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1069,6 +1090,7 @@ func (h *Handlers) FolderHandler(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"allowed_image_extensions": h.config.AllowedImageExtensions,
"allowed_file_extensions": h.config.AllowedFileExtensions,
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "folder_content",
@@ -1085,6 +1107,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid note path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Note path must end with .md or .markdown",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1098,6 +1121,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1111,6 +1135,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This note is not accessible",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1124,6 +1149,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1134,6 +1160,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this note",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1169,6 +1196,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Note not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested note does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1180,6 +1208,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "Note not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested note does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1194,6 +1223,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read note",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1207,6 +1237,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to render markdown",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1220,6 +1251,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1253,6 +1285,7 @@ func (h *Handlers) NoteHandler(c *gin.Context) {
"active_path": utils.GetActivePath(folderPath),
"current_note": notePath,
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "note_content",
@@ -1377,6 +1410,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusBadRequest, "error", gin.H{
"error": "Invalid path",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "Path traversal is not allowed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1390,6 +1424,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Permission check failed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1400,6 +1435,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "Access denied",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "You do not have permission to view this file",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1414,6 +1450,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusNotFound, "error", gin.H{
"error": "File not found",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "The requested file does not exist",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1427,6 +1464,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusForbidden, "error", gin.H{
"error": "File type not allowed",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": "This file type cannot be viewed",
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1440,6 +1478,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to read file",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1453,6 +1492,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
c.HTML(http.StatusInternalServerError, "error", gin.H{
"error": "Failed to build tree structure",
"app_name": h.config.AppName,
"LoginAndEdits": h.config.LoginAndEdits,
"message": err.Error(),
"ContentTemplate": "error_content",
"ScriptsTemplate": "error_scripts",
@@ -1482,6 +1522,7 @@ func (h *Handlers) ViewTextHandler(c *gin.Context) {
"notes_tree": notesTree,
"active_path": utils.GetActivePath(folderPath),
"breadcrumbs": utils.GenerateBreadcrumbs(folderPath),
"LoginAndEdits": h.config.LoginAndEdits,
"Authenticated": isAuthenticated(c),
"IsAdmin": isAdmin(c),
"ContentTemplate": "view_text_content",
@@ -1664,6 +1705,7 @@ func (h *Handlers) AdminPage(c *gin.Context) {
"breadcrumbs": utils.GenerateBreadcrumbs(""),
"Authenticated": true,
"IsAdmin": true,
"LoginAndEdits": h.config.LoginAndEdits,
"users": users,
"groups": groups,
"permissions": perms,