diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/repo_form.go | 10 | ||||
-rw-r--r-- | modules/templates/helper.go | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index da9a845807..4aa9ce5f58 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -521,3 +521,13 @@ func (f *AddTimeManuallyForm) Validate(ctx *macaron.Context, errs binding.Errors type SaveTopicForm struct { Topics []string `binding:"topics;Required;"` } + +// DeadlineForm hold the validation rules for deadlines +type DeadlineForm struct { + DateString string `form:"date" binding:"Required;Size(10)"` +} + +// Validate validates the fields +func (f *DeadlineForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) +} diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 74e775cc63..bf5c0130b6 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -183,6 +183,9 @@ func NewFuncMap() []template.FuncMap { "Printf": fmt.Sprintf, "Escape": Escape, "Sec2Time": models.SecToTime, + "ParseDeadline": func(deadline string) []string { + return strings.Split(deadline, "|") + }, }} } |