mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 10:42:57 +00:00
dev day #100 - WE ARE FUCKING DONE, hotfixes incoming but we did it in 100 days, lets fucking go guys, anyone reading this...i love you
This commit is contained in:
@@ -17,21 +17,24 @@ const (
|
||||
// NavigationItem represents a single navigation menu item
|
||||
type NavigationItem struct {
|
||||
gorm.Model
|
||||
Label string `gorm:"not null" json:"label"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Type NavigationItemType `gorm:"not null;default:'internal'" json:"type"`
|
||||
PageType string `json:"page_type,omitempty"` // e.g., 'blog', 'about', 'calendar'
|
||||
PageID *uint `json:"page_id,omitempty"` // optional reference to specific content
|
||||
Visible bool `gorm:"not null;default:true" json:"visible"`
|
||||
DisplayOrder int `gorm:"not null;default:0" json:"display_order"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
Parent *NavigationItem `gorm:"foreignKey:ParentID" json:"parent,omitempty"`
|
||||
Children []NavigationItem `gorm:"foreignKey:ParentID" json:"children,omitempty"`
|
||||
Target string `gorm:"default:'_self'" json:"target"` // _self or _blank
|
||||
CSSClass string `json:"css_class,omitempty"`
|
||||
RequiresAuth bool `gorm:"default:false" json:"requires_auth"`
|
||||
RequiresAdmin bool `gorm:"default:false" json:"requires_admin"`
|
||||
Label string `gorm:"not null" json:"label"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Type NavigationItemType `gorm:"not null;default:'internal'" json:"type"`
|
||||
PageType string `json:"page_type,omitempty"` // e.g., 'blog', 'about', 'calendar'
|
||||
PageID *uint `json:"page_id,omitempty"` // optional reference to specific content
|
||||
Visible bool `gorm:"not null;default:true" json:"visible"`
|
||||
DisplayOrder int `gorm:"not null;default:0" json:"display_order"`
|
||||
ParentID *uint `json:"parent_id,omitempty"`
|
||||
Parent *NavigationItem `gorm:"foreignKey:ParentID" json:"parent,omitempty"`
|
||||
Children []NavigationItem `gorm:"foreignKey:ParentID" json:"children,omitempty"`
|
||||
Target string `gorm:"default:'_self'" json:"target"` // _self or _blank
|
||||
CSSClass string `json:"css_class,omitempty"`
|
||||
RequiresAuth bool `gorm:"default:false" json:"requires_auth"`
|
||||
RequiresAdmin bool `gorm:"default:false" json:"requires_admin"`
|
||||
// AllowEditor indicates that editors are allowed to access the corresponding admin page
|
||||
// when this item represents an admin navigation entry (RequiresAdmin=true).
|
||||
AllowEditor bool `gorm:"default:false" json:"allow_editor"`
|
||||
}
|
||||
|
||||
// TableName specifies the table name for the NavigationItem model
|
||||
@@ -44,7 +47,7 @@ func (n *NavigationItem) GetURL() string {
|
||||
if n.URL != "" {
|
||||
return n.URL
|
||||
}
|
||||
|
||||
|
||||
// Map page types to URLs for frontend
|
||||
if n.Type == NavTypePage && n.PageType != "" {
|
||||
pageURLMap := map[string]string{
|
||||
@@ -66,47 +69,47 @@ func (n *NavigationItem) GetURL() string {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Map admin page types to URLs
|
||||
if (n.Type == NavTypeInternal || n.Type == NavTypePage) && n.PageType != "" && n.RequiresAdmin {
|
||||
adminURLMap := map[string]string{
|
||||
"dashboard": "/admin",
|
||||
"analytics": "/admin/analytika",
|
||||
"teams": "/admin/tymy",
|
||||
"matches": "/admin/zapasy",
|
||||
"activities": "/admin/aktivity",
|
||||
"players": "/admin/hraci",
|
||||
"articles": "/admin/clanky",
|
||||
"categories": "/admin/kategorie",
|
||||
"about": "/admin/o-klubu",
|
||||
"videos": "/admin/videa",
|
||||
"gallery": "/admin/galerie",
|
||||
"scoreboard": "/admin/scoreboard",
|
||||
"scoreboard_remote": "/admin/scoreboard/remote",
|
||||
"clothing": "/admin/obleceni",
|
||||
"sponsors": "/admin/sponzori",
|
||||
"banners": "/admin/bannery",
|
||||
"messages": "/admin/zpravy",
|
||||
"contacts": "/admin/kontakty",
|
||||
"newsletter": "/admin/newsletter",
|
||||
"polls": "/admin/ankety",
|
||||
"comments": "/admin/komentare",
|
||||
"sweepstakes": "/admin/sweepstakes",
|
||||
"navigation": "/admin/navigace",
|
||||
"dashboard": "/admin",
|
||||
"analytics": "/admin/analytika",
|
||||
"teams": "/admin/tymy",
|
||||
"matches": "/admin/zapasy",
|
||||
"activities": "/admin/aktivity",
|
||||
"players": "/admin/hraci",
|
||||
"articles": "/admin/clanky",
|
||||
"categories": "/admin/kategorie",
|
||||
"about": "/admin/o-klubu",
|
||||
"videos": "/admin/videa",
|
||||
"gallery": "/admin/galerie",
|
||||
"scoreboard": "/admin/scoreboard",
|
||||
"scoreboard_remote": "/admin/scoreboard/remote",
|
||||
"clothing": "/admin/obleceni",
|
||||
"sponsors": "/admin/sponzori",
|
||||
"banners": "/admin/bannery",
|
||||
"messages": "/admin/zpravy",
|
||||
"contacts": "/admin/kontakty",
|
||||
"newsletter": "/admin/newsletter",
|
||||
"polls": "/admin/ankety",
|
||||
"comments": "/admin/komentare",
|
||||
"sweepstakes": "/admin/sweepstakes",
|
||||
"navigation": "/admin/navigace",
|
||||
"competition_aliases": "/admin/aliasy-soutezi",
|
||||
"prefetch": "/admin/prefetch",
|
||||
"users": "/admin/uzivatele",
|
||||
"settings": "/admin/nastaveni",
|
||||
"shortlinks": "/admin/shortlinks",
|
||||
"files": "/admin/soubory",
|
||||
"docs": "/admin/docs",
|
||||
"engagement": "/admin/engagement",
|
||||
"prefetch": "/admin/prefetch",
|
||||
"users": "/admin/uzivatele",
|
||||
"settings": "/admin/nastaveni",
|
||||
"shortlinks": "/admin/shortlinks",
|
||||
"files": "/admin/soubory",
|
||||
"docs": "/admin/docs",
|
||||
"engagement": "/admin/engagement",
|
||||
}
|
||||
if url, ok := adminURLMap[n.PageType]; ok {
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "#"
|
||||
}
|
||||
|
||||
@@ -130,7 +133,7 @@ func (s *SocialLink) GetIconName() string {
|
||||
if s.Icon != "" {
|
||||
return s.Icon
|
||||
}
|
||||
|
||||
|
||||
iconMap := map[string]string{
|
||||
"facebook": "FaFacebook",
|
||||
"instagram": "FaInstagram",
|
||||
@@ -141,10 +144,10 @@ func (s *SocialLink) GetIconName() string {
|
||||
"discord": "FaDiscord",
|
||||
"twitch": "FaTwitch",
|
||||
}
|
||||
|
||||
|
||||
if icon, ok := iconMap[s.Platform]; ok {
|
||||
return icon
|
||||
}
|
||||
|
||||
|
||||
return "FaLink"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user