From 0b18a29521ec8cb46bf0de21a86ff2f5e7a9da9c Mon Sep 17 00:00:00 2001 From: pikachu0542 <112343747+pikachu0542@users.noreply.github.com> Date: Mon, 16 Feb 2026 11:16:31 -0500 Subject: [PATCH 1/2] Add feedback for why users cant vote (#74) * Added alert on results screen for when you already voted * Added banner alert telling user that they already voted * Tried to make the alert have vertically centered text * Fixed vertical centering (thanks noah) * Added alert for if user is inactive * Updated alert to account for inactive and gatekept, added alert for db error * Updated alert to account for inactive and gatekept, added alert for db error * Added sentence telling people to contact evals or opcomm for more info --- main.go | 1 + templates/result.tmpl | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/main.go b/main.go index a5f1a2a..19eb373 100644 --- a/main.go +++ b/main.go @@ -430,6 +430,7 @@ func main() { "IsOpen": poll.Open, "IsHidden": poll.Hidden, "CanModify": canModify, + "CanVote": canVote(claims.UserInfo, *poll, poll.AllowedUsers), "Username": claims.UserInfo.Username, "FullName": claims.UserInfo.FullName, "Gatekeep": poll.Gatekeep, diff --git a/templates/result.tmpl b/templates/result.tmpl index 9e81f54..5e5e1c2 100644 --- a/templates/result.tmpl +++ b/templates/result.tmpl @@ -9,6 +9,12 @@ media="screen" /> + +
+ {{ if eq .CanVote 9 }} + + {{ else if eq .CanVote 1 }} + + {{ else if gt .CanVote 1 }} + + {{ end }} +

{{ .ShortDescription }}

{{ if .LongDescription }}

{{ .LongDescription | MakeLinks }}

@@ -38,6 +71,7 @@

Results will be available once the poll closes

{{ else }} + {{/* Displays information about required quorum and number of voters */}}
Number of Eligible Voters: {{ len .EligibleVoters }}
From ccd38303e9b61ac2674a4daa4486d5095f7c8a88 Mon Sep 17 00:00:00 2001 From: pikachu0542 <112343747+pikachu0542@users.noreply.github.com> Date: Mon, 16 Feb 2026 20:03:54 -0500 Subject: [PATCH 2/2] Move closed polls to separate page (#75) --- main.go | 29 +++++++++++++++++++++- templates/closed.tmpl | 48 +++++++++++++++++++++++++++++++++++++ templates/create.tmpl | 14 ++--------- templates/hidden.tmpl | 15 ++---------- templates/index.tmpl | 48 ++++--------------------------------- templates/nav.tmpl | 18 ++++++++++++++ templates/poll.tmpl | 13 +--------- templates/result.tmpl | 13 +--------- templates/unauthorized.tmpl | 13 +--------- 9 files changed, 106 insertions(+), 105 deletions(-) create mode 100644 templates/closed.tmpl create mode 100644 templates/nav.tmpl diff --git a/main.go b/main.go index 19eb373..f63d8a4 100644 --- a/main.go +++ b/main.go @@ -126,7 +126,34 @@ func main() { closedPolls = uniquePolls(closedPolls) c.HTML(200, "index.tmpl", gin.H{ - "Polls": polls, + "Polls": polls, + "Username": claims.UserInfo.Username, + "FullName": claims.UserInfo.FullName, + }) + })) + + r.GET("/closed", csh.AuthWrapper(func(c *gin.Context) { + cl, _ := c.Get("cshauth") + claims := cl.(cshAuth.CSHClaims) + + closedPolls, err := database.GetClosedVotedPolls(c, claims.UserInfo.Username) + if err != nil { + c.JSON(500, gin.H{"error": err.Error()}) + return + } + ownedPolls, err := database.GetClosedOwnedPolls(c, claims.UserInfo.Username) + if err != nil { + c.JSON(500, gin.H{"error": err.Error()}) + return + } + closedPolls = append(closedPolls, ownedPolls...) + + sort.Slice(closedPolls, func(i, j int) bool { + return closedPolls[i].Id > closedPolls[j].Id + }) + closedPolls = uniquePolls(closedPolls) + + c.HTML(200, "closed.tmpl", gin.H{ "ClosedPolls": closedPolls, "Username": claims.UserInfo.Username, "FullName": claims.UserInfo.FullName, diff --git a/templates/closed.tmpl b/templates/closed.tmpl new file mode 100644 index 0000000..199036f --- /dev/null +++ b/templates/closed.tmpl @@ -0,0 +1,48 @@ + + + + CSH Vote + + + + + + + + {{ template "nav" . }} +
+

+
Closed Polls
+

+
+
+ +
+
+ + diff --git a/templates/create.tmpl b/templates/create.tmpl index 1fbeeba..14f1299 100644 --- a/templates/create.tmpl +++ b/templates/create.tmpl @@ -7,18 +7,8 @@ - + {{ template "nav" . }} +

Create Poll

diff --git a/templates/hidden.tmpl b/templates/hidden.tmpl index e7a0969..a2740be 100644 --- a/templates/hidden.tmpl +++ b/templates/hidden.tmpl @@ -20,19 +20,8 @@ - - + {{ template "nav" . }} +
- + {{ template "nav" . }}

Active Polls
@@ -47,43 +36,16 @@ class="list-group-item list-group-item-action" href="/poll/{{ $poll.Id }}" > - {{ - $poll.ShortDescription - }} - - (created by {{ $poll.CreatedBy }}) - - - {{ - end - }} - -

-
-

Closed Polls

-
-
-
diff --git a/templates/nav.tmpl b/templates/nav.tmpl new file mode 100644 index 0000000..7c746f8 --- /dev/null +++ b/templates/nav.tmpl @@ -0,0 +1,18 @@ +{{ define "nav" }} + + +{{ end }} \ No newline at end of file diff --git a/templates/poll.tmpl b/templates/poll.tmpl index a501a09..0f074a3 100644 --- a/templates/poll.tmpl +++ b/templates/poll.tmpl @@ -12,18 +12,7 @@ - + {{ template "nav" . }}

{{ .ShortDescription }}

diff --git a/templates/result.tmpl b/templates/result.tmpl index 5e5e1c2..45d060b 100644 --- a/templates/result.tmpl +++ b/templates/result.tmpl @@ -17,18 +17,7 @@ - + {{ template "nav" . }}
{{ if eq .CanVote 9 }} diff --git a/templates/unauthorized.tmpl b/templates/unauthorized.tmpl index 8d18de1..0a5d226 100644 --- a/templates/unauthorized.tmpl +++ b/templates/unauthorized.tmpl @@ -20,18 +20,7 @@ - + {{ template "nav" . }}