Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,21 @@ func GetPollResults(c *gin.Context) {
return
}

fmt.Println(len(results))
numVotes := 0

for _, v := range results {
for key := range v {
numVotes += v[key]
}
}

c.HTML(http.StatusOK, "result.tmpl", gin.H{
"Id": poll.Id,
"Title": poll.Title,
"Description": poll.Description,
"VoteType": poll.VoteType,
"Results": results,
"NumVotes": len(results),
"NumVotes": numVotes,
"IsOpen": poll.Open,
"IsHidden": poll.Hidden,
"CanModify": canModify,
Expand Down
6 changes: 3 additions & 3 deletions templates/create.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
</select>
</div>
<div id="customOptions" class="input-group d-none my-3">
<label for="customOptions" class="input-group-text">Custom Options</label>
<label for="customOptions" class="input-group-text">Custom Vote Options</label>
<input
type="text"
name="customOptions"
class="form-control"
placeholder="Enter a comma separated list of custom options"
placeholder="Enter a comma separated list of custom vote options"
>
</div>

Expand Down Expand Up @@ -112,7 +112,7 @@
</div>
{{ end }}

<input type="submit" class="btn btn-primary" value="Create">
<input type="submit" class="btn btn-primary my-2" value="Create">
</form>
</div>

Expand Down
4 changes: 2 additions & 2 deletions templates/poll.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<form action="/poll/{{ .Id }}" method="POST">
{{ if eq .PollType "simple" }}
{{ range $i, $option := .Options }}
<div class="form-check fs-4">
<div class="form-check fs-4 lh-sm">
<input class="form-check-input" type="radio" name="option" id="{{ $option }}" value="{{ $option }}" />
<label class="form-check-label" for="{{ $option }}">{{ $option }}</label>
</div>
<br />
{{ end }}
{{ if .AllowWriteIns }}
<div class="form-check fs-4">
<div class="form-check fs-4 lh-sm">
<input class="form-check-input" type="radio" name="option" value="writein" />
<input
type="text"
Expand Down
2 changes: 1 addition & 1 deletion templates/result.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{ end }}
{{ end }}

<h2>{{ .Title }}</h2>
<h2 class="text-break">{{ .Title }}</h2>
{{ if .Description }}
<h4>{{ .Description | MakeLinks }}</h4>
{{ end }}
Expand Down
Loading