summaryrefslogtreecommitdiff
path: root/forms.go
diff options
context:
space:
mode:
authorJan Dittberner <jan@dittberner.info>2017-04-30 02:37:29 +0200
committerJan Dittberner <jan@dittberner.info>2017-04-30 02:37:29 +0200
commitc48bd9e356f16fcf8c14f7c6e34aec2469fe51bb (patch)
tree96738ad2795834c46dddcc7d96a7099a8cbf22bf /forms.go
parent1c989fdfa3d15b35342d439bcb3fbab894b6d46c (diff)
downloadcacert-boardvoting-c48bd9e356f16fcf8c14f7c6e34aec2469fe51bb.tar.gz
cacert-boardvoting-c48bd9e356f16fcf8c14f7c6e34aec2469fe51bb.tar.xz
cacert-boardvoting-c48bd9e356f16fcf8c14f7c6e34aec2469fe51bb.zip
Use Semantic UI for all HTML templates0.2.0
Diffstat (limited to 'forms.go')
-rw-r--r--forms.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/forms.go b/forms.go
index e0d430a..bfd62ee 100644
--- a/forms.go
+++ b/forms.go
@@ -29,22 +29,22 @@ func (f *NewDecisionForm) Validate() (bool, *Decision) {
data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 {
- f.Errors["Title"] = "Please enter at least 3 characters."
+ f.Errors["Title"] = "Please enter at least 3 characters for Title."
}
data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 {
- f.Errors["Content"] = "Please enter at least 3 words."
+ f.Errors["Content"] = "Please enter at least 3 words as Text."
}
if voteType, err := strconv.ParseUint(f.VoteType, 10, 8); err != nil || (voteType != 0 && voteType != 1) {
- f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type", err)
+ f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type.", err)
} else {
data.VoteType = VoteType(uint8(voteType))
}
if dueDuration, ok := validDueDurations[f.Due]; !ok {
- f.Errors["Due"] = "Please choose a valid due date"
+ f.Errors["Due"] = "Please choose a valid due date."
} else {
year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC)
@@ -69,22 +69,22 @@ func (f *EditDecisionForm) Validate() (bool, *Decision) {
data.Title = strings.TrimSpace(f.Title)
if len(data.Title) < 3 {
- f.Errors["Title"] = "Please enter at least 3 characters."
+ f.Errors["Title"] = "Please enter at least 3 characters for Title."
}
data.Content = strings.TrimSpace(f.Content)
if len(strings.Fields(data.Content)) < 3 {
- f.Errors["Content"] = "Please enter at least 3 words."
+ f.Errors["Content"] = "Please enter at least 3 words as Text."
}
if voteType, err := strconv.ParseUint(f.VoteType, 10, 8); err != nil || (voteType != 0 && voteType != 1) {
- f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type", err)
+ f.Errors["VoteType"] = fmt.Sprint("Please choose a valid vote type.", err)
} else {
data.VoteType = VoteType(uint8(voteType))
}
if dueDuration, ok := validDueDurations[f.Due]; !ok {
- f.Errors["Due"] = "Please choose a valid due date"
+ f.Errors["Due"] = "Please choose a valid due date."
} else {
year, month, day := time.Now().UTC().Add(dueDuration).Date()
data.Due = time.Date(year, month, day, 23, 59, 59, 0, time.UTC)
@@ -107,24 +107,24 @@ func (f *ProxyVoteForm) Validate() (bool, *Voter, *Vote, string) {
var voter *Voter
if voterId, err := strconv.ParseInt(f.Voter, 10, 64); err != nil {
- f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter", err)
+ f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter.", err)
} else if voter, err = GetVoterById(voterId); err != nil {
- f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter", err)
+ f.Errors["Voter"] = fmt.Sprint("Please choose a valid voter.", err)
} else {
data.VoterId = voter.Id
}
if vote, err := strconv.ParseInt(f.Vote, 10, 8); err != nil {
- f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote", err)
+ f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote.", err)
} else if voteChoice, ok := VoteChoices[vote]; !ok {
- f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote")
+ f.Errors["Vote"] = fmt.Sprint("Please choose a valid vote.")
} else {
data.Vote = voteChoice
}
justification := strings.TrimSpace(f.Justification)
if len(justification) < 3 {
- f.Errors["Justification"] = "Please enter at least 3 characters."
+ f.Errors["Justification"] = "Please enter at least 3 characters for justification."
}
return len(f.Errors) == 0, voter, data, justification