diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -30,12 +30,13 @@ var ideas_html string var Ideas []Idea // ToDo's -// - [ ] Add a post -// - [ ] Remove a post +// - [x] Add a post +// - [x] Remove a post // - [ ] work with funcmaps in templates // - [ ] Put a reaction on a post // - [x] Store ideas to a file (encoder/gob) // - [x] Change the date format printing +// - [x] outsource removing the posts to a separate cli tool // Represents an idea // CreatedAt is a formatted date string @@ -166,6 +167,10 @@ func main() { CreatedAt: time.Now().Format(DateLayout), Text: r.FormValue("text"), } + if i.Title == "" || i.Author == "" || i.Text == "" { + tmpl.Execute(w, PageData{Ideas, "All fields are required"}) + return + } for _, v := range Ideas { if i.Title == v.Title { |