mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 23:50:48 +02:00
- Added sorting capabilities to file metadata lists, including SortBy and SortDir fields. - Integrated a toast notification system for user feedback on actions. - Updated templates and JavaScript for improved user interaction and responsiveness. - Refactored file metadata handlers to utilize new sorting features and ensure proper data flow. - Introduced new notification dialog components for better user confirmation on actions.
29 lines
614 B
Go
29 lines
614 B
Go
package utils
|
|
|
|
// Contains checks if a string is in a slice.
|
|
func Contains(slice []string, str string) bool {
|
|
for _, s := range slice {
|
|
if s == str {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// BoolToString converts bool to string for HTML attributes.
|
|
// Returns "true" for true, "" for false (useful for checked attribute).
|
|
func BoolToString(b bool) string {
|
|
if b {
|
|
return "true"
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// GetNotificationFormTitle returns the appropriate title for the form.
|
|
func GetNotificationFormTitle(isNew bool) string {
|
|
if isNew {
|
|
return "Add Notification Service"
|
|
}
|
|
return "Edit Notification Service"
|
|
}
|