Add restore functionality for archived messages
- Added `RestoreMessageHandler` and route at `/account/messages/restore` - Updated `users_messages` table to support `archived_at` reset - Added restore button to archived messages template - Ensures archived messages can be moved back into inbox
This commit is contained in:
@@ -16,3 +16,11 @@ func GetTotalPages(db *sql.DB, tableName, whereClause string, args []interface{}
|
||||
}
|
||||
return totalPages, totalCount
|
||||
}
|
||||
|
||||
func MakePageRange(current, total int) []int {
|
||||
var pages []int
|
||||
for i := 1; i <= total; i++ {
|
||||
pages = append(pages, i)
|
||||
}
|
||||
return pages
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ func TemplateFuncs() template.FuncMap {
|
||||
},
|
||||
"mul": func(a, b int) int { return a * b },
|
||||
"add": func(a, b int) int { return a + b },
|
||||
"sub": func(a, b int) int { return a - b },
|
||||
"min": func(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
@@ -66,6 +67,7 @@ func TemplateFuncs() template.FuncMap {
|
||||
}
|
||||
return s[:max] + "..."
|
||||
},
|
||||
"PageRange": PageRange,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,3 +117,11 @@ func rangeClass(n int) string {
|
||||
return "50-plus"
|
||||
}
|
||||
}
|
||||
|
||||
func PageRange(current, total int) []int {
|
||||
var pages []int
|
||||
for i := 1; i <= total; i++ {
|
||||
pages = append(pages, i)
|
||||
}
|
||||
return pages
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user