summaryrefslogtreecommitdiffstats
path: root/cmd/web/handlers.go (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-02-12An Operations list page now renders data in tableMatthew Lemon1-3/+1
The data is fetched from the database and uses html/template to render the rows in a list. A critical bug was not including the dot in {{ template "main" . }} in the base template. THIS MEANT THAT NO DATA PASSED TO ExecuteTemplate function rendered and took a long time to figure out.
2024-02-11wip: Cannot get the dynamic data to show up in templateMatthew Lemon1-6/+12
2024-02-11Adds an operations html templateMatthew Lemon1-4/+17
Does not contain any dynamic data at this point, i.e. does not actually list the operations from the database - just dummy data at this point.
2024-02-11Have added a listAll handler for new operation modelMatthew Lemon1-0/+13
This is the first attempt at querying a table with a foreign key relation and returning the result to be used in Go code. Learned quite a bit! Including getting a null pointer error because I forgot to initialise the sql.DB in the application structure.
2024-02-10Implements Latest() organisation model methodMatthew Lemon1-11/+21
And puts the list in plain text on the home page.
2024-02-10Adds the Get handler for organisation model and fixesMatthew Lemon1-24/+38
Also fixes the NotAuthorised response I was mistakenly getting when it should have been a 404.
2024-02-10Adds the view handler for our organisation modelMatthew Lemon1-0/+4
We omitted to include this earlier and it is needed for the create handler, which creates the new entity in the database and then redirects to the view handler which will show the organisation page.
2024-02-10Adds a comment above code to handle "/" routeMatthew Lemon1-0/+4
We only want "/" to match the home route; this comment explains that.
2024-02-10Adds missing importMatthew Lemon1-1/+0
2024-02-10Have added Insert handler for Organisation modelMatthew Lemon1-13/+19
This is a straight forward wrapper around INSERT. Also added a clientError into a new helpers.go file.
2024-02-08Added nav partialMatthew Lemon1-2/+2
Added a partial html for the navigation bar. So far it just has a link to "Home" on it.
2024-02-08Created a /organisations/list routeMatthew Lemon1-1/+20
There is also some basic CSS here. Also introduced a proper structured logger.
2024-02-08First proper use of templatesMatthew Lemon1-1/+1
2024-02-08First appearance of HTML on the home pageMatthew Lemon1-1/+33
2024-02-08Moved main to cmd/web and added routes() methodMatthew Lemon1-0/+18
Started to separate out funtionality: added an application struct and several methods (routes(), home() and a notFound() error). At the moment, the application struct does not carry any other configuration objects or a database pool connection - it is just there to get the routing going.