summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Adds the basic table rendering to the Organisation list pageHEADmasterMatthew Lemon2024-02-151-17/+14
| | | | | Removes the raw data dump of the []Organisation slice and renders the dummy contents in a template.
* Implementing the templateCache in organisations listMatthew Lemon2024-02-153-14/+13
| | | | | | | | | | | The render() function at the moment requires a templateData struct to be passed to it, but prior to this commit, that struct only had an Operations field in it. We have now added an Organisations field too - the thinking being that we only add the data we need for the page in question and the other fields remain as nil values. As of this commit - the slice of Organisations passed is not rendered correctly by the template - just a raw data dump to prove it works.
* Implemented template cacheMatthew Lemon2024-02-156-22/+74
| | | | | | | | | | | | | | | | | This is not perfect. At the moment, the new render() function, introduced in this commit, expects a templateData{} struct which contains an Operations field. This will need to be made generic, or we have multiple render() functions to accommdate the different types of data struct we want to be able to pass to templates. Also, in this commit I had to get rid of the /pages/operations and /pages/organisation sub directories for now. This does not fit the newTemplateCache() function - also introduced here. This needs to be refactored if we want to have subdirectories of templates - or else we stick to putting them inside pages/ and we name them appropriately, as we have done here with operations_list and organisation_list templates.
* Switched off the gradient background in the table headerMatthew Lemon2024-02-151-1/+1
|
* If we want table stripes...Matthew Lemon2024-02-121-0/+5
|
* Adds gradient to table headerMatthew Lemon2024-02-121-1/+2
|
* More styling - reverted from gray backgroundMatthew Lemon2024-02-123-44/+56
| | | | | | | Have moved to white background and given the whole content a padding on the left and right. Have commented out the table width styling for now as it's now required but want to leave it in there for the forseeable as I'm sure I will come back to it.
* Introduces much better styling of the operations tableMatthew Lemon2024-02-122-5/+42
|
* Removes the bullet from a listMatthew Lemon2024-02-121-0/+6
| | | | | This makes things much neater when the list is rendered inside a table cell.
* Method to format an EngagementStrategy for renderingMatthew Lemon2024-02-122-3/+11
| | | | | The objective is to render a link to the ES in the Operations table. Only the start year and end year are required for it to make sense.
* Some formatting for ESes in Ops tableMatthew Lemon2024-02-123-4/+16
| | | | | Added another dummy ES to Operation 1 in test data so I can test the listing inside the table - it still does not look correct though.
* Operations list shows ESs for each entityMatthew Lemon2024-02-124-22/+46
| | | | | | | | | | This was about two hours of learning, and getting confused - and it needs to be refactored. We need to be able to generate the list of EPs for the Operation also. At the moment this only prints the object representation. More work to be done writing a method that gives us the id and textual representation for the link in the table.
* wip: mating EPs with OperationsMatthew Lemon2024-02-125-9/+78
|
* Adds mock ES and EP entries in Ops tableMatthew Lemon2024-02-121-0/+4
|
* Updates populate file with correct set upMatthew Lemon2024-02-121-2/+6
|
* Changes table header text to normal font weight.Matthew Lemon2024-02-121-0/+1
|
* Adds lorem ipsum text to operations pageMatthew Lemon2024-02-121-0/+4
| | | | Just for padding at this stage.
* Just adding a couple more demo dataMatthew Lemon2024-02-121-0/+2
|
* An Operations list page now renders data in tableMatthew Lemon2024-02-125-29/+15
| | | | | | | | | 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.
* wip: Cannot get the dynamic data to show up in templateMatthew Lemon2024-02-113-7/+30
|
* Adds an operations html templateMatthew Lemon2024-02-114-5/+57
| | | | | 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.
* Have added a listAll handler for new operation modelMatthew Lemon2024-02-114-5/+54
| | | | | | | 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.
* Started the Operation modelMatthew Lemon2024-02-112-1/+43
|
* Further tinkering with CSSMatthew Lemon2024-02-113-5/+11
|
* Adds entr command to re-run run commandMatthew Lemon2024-02-111-0/+3
|
* Started mocking out home page in HTML and CSSMatthew Lemon2024-02-112-0/+42
| | | | | | Adding initial styles; currently working on a big summary table for the front page, that is going to provide the main entry point to all the relevant business data.
* Adds small-font cssMatthew Lemon2024-02-114-3/+933
| | | | | | | | Basing CSS styles on the look and feel of cgit, this commit actually includes the cgit css file in the tree for reference. I don't want to get too carried away with CSS at this point but this is a start.
* wip: tweak to font sizeMatthew Lemon2024-02-111-3/+3
|
* Implements Latest() organisation model methodMatthew Lemon2024-02-102-11/+51
| | | | And puts the list in plain text on the home page.
* Adds the Get handler for organisation model and fixesMatthew Lemon2024-02-104-28/+70
| | | | | Also fixes the NotAuthorised response I was mistakenly getting when it should have been a 404.
* Adds the view handler for our organisation modelMatthew Lemon2024-02-102-0/+6
| | | | | | 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.
* Adds a comment above code to handle "/" routeMatthew Lemon2024-02-101-0/+4
| | | | We only want "/" to match the home route; this comment explains that.
* Adds missing importMatthew Lemon2024-02-101-1/+0
|
* Have added Insert handler for Organisation modelMatthew Lemon2024-02-104-53/+58
| | | | | | This is a straight forward wrapper around INSERT. Also added a clientError into a new helpers.go file.
* Adds the Organisations modelMatthew Lemon2024-02-092-2/+34
| | | | | | | | | | | | | | | We have separation of concerns: the model is initalised and passed into the app struct, therefore our database logic will not be tied to our handlers. Our model, with its methods, is nicely encapsulated. We can initialise it and pass it to our handlers as a dependency. We can in future create an interface to mock the OrganisationModel object to be used in unit testing. We can also switch databases (theoretically) but providing a -dsn command-line flag.
* Adds the database driver and opens database poolMatthew Lemon2024-02-091-4/+36
| | | | | | | | Adds the new -dsn flag so that the user can pass any database into the program. Adds a new function that wraps sql.Open() to create the connection pool, and pings it to ensure it is alive.
* Adds flagsMatthew Lemon2024-02-092-3/+11
| | | | | | | | | Accepts -addr for the port. Commented out flag for dsn (database string) - not yet implemented. See https://github.com/go-sql-driver/mysql#dsn-data-source-name for the correct format to be used for MySQL/MariaDB.
* Adds my-sql driver dependencyMatthew Lemon2024-02-092-0/+4
|
* Adds a populate.sql scriptMatthew Lemon2024-02-092-0/+31
| | | | | | | | | | We need a script to run for populating and bootstrapping the database. This is the start of such a script. The syntax here is suitable for mariadb at present. The comments above "populate" are assumed to have been carried out by the root user (e.g. sudo mariabdb).
* Added nav partialMatthew Lemon2024-02-083-3/+8
| | | | | Added a partial html for the navigation bar. So far it just has a link to "Home" on it.
* Created a /organisations/list routeMatthew Lemon2024-02-087-5/+91
| | | | | | There is also some basic CSS here. Also introduced a proper structured logger.
* First proper use of templatesMatthew Lemon2024-02-083-3/+14
|
* First appearance of HTML on the home pageMatthew Lemon2024-02-082-1/+46
|
* Moved main to cmd/web and added routes() methodMatthew Lemon2024-02-085-19/+46
| | | | | | | | | 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.
* Adds a MakefileMatthew Lemon2024-02-081-0/+8
| | | | I don't want to have to remember docker commands ever again!
* Adds DockerfileMatthew Lemon2024-01-311-0/+8
|
* Initial commit for testingMatthew Lemon2024-01-312-0/+21