diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-28 03:34:54 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-28 13:54:46 +0200 |
commit | b96600e2bb06e086282ffc8a2447c682569961b2 (patch) | |
tree | 44c5d3c0b02263ffd3fce503c5ce494d4eaf1898 /main.go | |
parent | 39a847ce13295290e43ef92784fa7fc27a842aa2 (diff) |
added ui changes
- Added a delete button next to each idea instead of deleting them by
name
- Changed Post to Think
- Added a text when there are no ideas
- Added more CSS for the create
- Added checks for denying empty fields
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 { |