From e638d0c4630fbb18adaef74b37b096f3bc6ca36f Mon Sep 17 00:00:00 2001 From: icxes Date: Thu, 1 Feb 2024 02:48:13 +0000 Subject: [PATCH 1/2] website: add staff page template --- assets/css/main.css | 12 ++++++++- templates/default/staff.tmpl | 51 ++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index c6c9dc7e..2a81a693 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -63,4 +63,14 @@ .pending-entry:nth-of-type(even) { background-color: hsl(0, 0%, 90%); -} \ No newline at end of file +} + +.content-border-top { + border-top: 2px rgba(0, 0, 0, .1) solid; +} + +.word-break-ellipsis { + word-break: unset; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/templates/default/staff.tmpl b/templates/default/staff.tmpl index 2b3c1912..ca192213 100644 --- a/templates/default/staff.tmpl +++ b/templates/default/staff.tmpl @@ -1,3 +1,50 @@ {{define "content"}} -Staff Page {{.}} -{{end}} \ No newline at end of file +
+
+
+ {{template "staff-rows" .}} +
+
+
+{{end}} + +{{define "staff-rows"}} +{{$ctx := .}} + {{range $role := $ctx.Roles}} +
+ {{template "staff-row-title" $role}} +
+ {{range $user := $ctx.Users}} + {{if and (eq $user.Visible 1) (eq $user.Role $role)}} + {{template "djcard" $user}} + {{end}} + {{end}} +
+
+ {{end}} +{{end}} + +{{define "staff-row-title"}} + {{if eq . "staff"}} +
Staff
+ {{else if eq . "dev"}} +
Developers
+ {{else}} +
DJs
+ {{end}} +{{end}} + +{{define "djcard"}} +
+
+
+
+ +
+
+
+
{{.DjName}}
+
+
+
+{{end}} From a8b27f31dbb51b7b4c3a21b8e51989946f275f4a Mon Sep 17 00:00:00 2001 From: icxes Date: Thu, 1 Feb 2024 03:24:58 +0000 Subject: [PATCH 2/2] add staff page dummy data --- website/public/staff.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/website/public/staff.go b/website/public/staff.go index e099bdf8..c6d23a5f 100644 --- a/website/public/staff.go +++ b/website/public/staff.go @@ -5,11 +5,43 @@ import ( "net/http" ) +type User = struct { + DjName string + DjImage string + Role string + Visible int +} + func (s State) GetStaff(w http.ResponseWriter, r *http.Request) { + + users := []User{ + {DjName:"benisman", DjImage:"1-59b10a1565ef8119.png", Role:"staff", Visible:1}, + {DjName:"fug", DjImage:"2-1a704457d3834f41.png", Role:"staff", Visible:1}, + {DjName:"testuser9000", DjImage:"3-8c035a1bcbcde125.png", Role:"dev", Visible:1}, + {DjName:"testuser9001", DjImage:"2-1a704457d3834f41.png", Role:"dev", Visible:1}, + {DjName:"gooddj", DjImage:"3-8c035a1bcbcde125.png", Role:"dj", Visible:1}, + {DjName:"gooddj2", DjImage:"3-8c035a1bcbcde125.png", Role:"dj", Visible:1}, + {DjName:"gooddj3", DjImage:"2-1a704457d3834f41.png", Role:"dj", Visible:1}, + {DjName:"gooddj4", DjImage:"1-59b10a1565ef8119.png", Role:"dj", Visible:1}, + {DjName:"gooddj5", DjImage:"3-8c035a1bcbcde125.png", Role:"dj", Visible:1}, + {DjName:"baddj", DjImage:"2-1a704457d3834f41.png", Role:"dj", Visible:1}, + {DjName:"gooddj6", DjImage:"3-8c035a1bcbcde125.png", Role:"dj", Visible:1}, + } + + roles := []string{ + "staff", + "dev", + "dj", + } + staffInput := struct { shared + Users []User + Roles []string }{ shared: s.shared(r), + Users: users, + Roles: roles, } err := s.TemplateExecutor.ExecuteFull(theme, "staff", w, staffInput)