💄 Better titles; go fmt
This commit is contained in:
parent
b8de119cc6
commit
8f3a5b35c8
4 changed files with 12 additions and 8 deletions
10
http/main.go
10
http/main.go
|
@ -94,7 +94,9 @@ func handleNewVoting(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleVotingForm(ctx echo.Context) error {
|
func handleVotingForm(ctx echo.Context) error {
|
||||||
return ctx.Render(http.StatusOK, "voting_form", nil)
|
return ctx.Render(http.StatusOK, "voting_form", map[string]interface{}{
|
||||||
|
"Title": "cvote",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleVote(ctx echo.Context) error {
|
func handleVote(ctx echo.Context) error {
|
||||||
|
@ -122,8 +124,9 @@ func handleVote(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
store.PlaceVote(id, vid, elector, c)
|
store.PlaceVote(id, vid, elector, c)
|
||||||
return ctx.Render(http.StatusFound, "thanks", map[string]interface{}{
|
return ctx.Render(http.StatusFound, "thanks", map[string]interface{}{
|
||||||
"Id": id,
|
"Title": "cvote | thx",
|
||||||
"Vid": vid,
|
"Id": id,
|
||||||
|
"Vid": vid,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +141,7 @@ func handleShowVoting(ctx echo.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ctx.Render(http.StatusOK, "voting", map[string]interface{}{
|
return ctx.Render(http.StatusOK, "voting", map[string]interface{}{
|
||||||
|
"Title": "cvote | " + v.Referendum(),
|
||||||
"Voting": v,
|
"Voting": v,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ func getVotes(id string) ([]vote.Vote, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
i string
|
i string
|
||||||
e string
|
e string
|
||||||
c vote.Choice
|
c vote.Choice
|
||||||
ts time.Time
|
ts time.Time
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (v Voting) Electors() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v Voting) Anonymous() bool {
|
func (v Voting) Anonymous() bool {
|
||||||
return v.annonymous
|
return v.annonymous
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v Voting) IsOpen() bool {
|
func (v Voting) IsOpen() bool {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Vote struct {
|
type Vote struct {
|
||||||
Id string
|
Id string
|
||||||
Elector string
|
Elector string
|
||||||
Choice Choice
|
Choice Choice
|
||||||
timestamp time.Time
|
timestamp time.Time
|
||||||
|
@ -14,7 +14,7 @@ type Vote struct {
|
||||||
|
|
||||||
func NewVote(id, elector string, choice Choice) Vote {
|
func NewVote(id, elector string, choice Choice) Vote {
|
||||||
return Vote{
|
return Vote{
|
||||||
Id: id,
|
Id: id,
|
||||||
Elector: elector,
|
Elector: elector,
|
||||||
Choice: choice,
|
Choice: choice,
|
||||||
timestamp: time.Now().UTC(),
|
timestamp: time.Now().UTC(),
|
||||||
|
@ -23,7 +23,7 @@ func NewVote(id, elector string, choice Choice) Vote {
|
||||||
|
|
||||||
func NewVoteWithTimestamp(id, elector string, choice Choice, timestamp time.Time) Vote {
|
func NewVoteWithTimestamp(id, elector string, choice Choice, timestamp time.Time) Vote {
|
||||||
return Vote{
|
return Vote{
|
||||||
Id: id,
|
Id: id,
|
||||||
Elector: elector,
|
Elector: elector,
|
||||||
Choice: choice,
|
Choice: choice,
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
|
|
Loading…
Reference in a new issue