<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ceres/view, branch v0.5.0</title>
<subtitle>Recipe server for your favorite dishes</subtitle>
<id>https://cgit.xengineering.eu/ceres/atom?h=v0.5.0</id>
<link rel='self' href='https://cgit.xengineering.eu/ceres/atom?h=v0.5.0'/>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/'/>
<updated>2024-11-03T15:06:58Z</updated>
<entry>
<title>view: Implement favorite recipes</title>
<updated>2024-11-03T15:06:58Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-11-03T14:50:08Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=c1b976edd0c27fdc488da7ff4c1b7551df0323cd'/>
<id>urn:sha1:c1b976edd0c27fdc488da7ff4c1b7551df0323cd</id>
<content type='text'>
This marks favorite recipes with a `⭐` emoticon. The favorite flag
value can be set on the recipe edit page. Favorite recipes are listed
first on the recipe list view.

Furthermore as a second priority the created time stamp is used in the
recipe list so that more recent recipes are listed first.
</content>
</entry>
<entry>
<title>view: Display URL content on recipe page</title>
<updated>2024-10-24T18:24:46Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-10-24T18:24:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=43ed47bf3d51e25d3195870241bbe6619c43e459'/>
<id>urn:sha1:43ed47bf3d51e25d3195870241bbe6619c43e459</id>
<content type='text'>
This makes the recipe page less pretty. Nevertheless the URL is more
visible to the user which makes it more likely that errors in the URL
are detected.

This change is based on user feedback. Invalid URLs were added which led
effectively to data loss.
</content>
</entry>
<entry>
<title>view: Order ingredient summary by ingredient name</title>
<updated>2024-10-24T18:14:14Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-10-24T15:24:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=9422e8194245c9cdbfa09b38c20173964349e2a2'/>
<id>urn:sha1:9422e8194245c9cdbfa09b38c20173964349e2a2</id>
<content type='text'>
This makes it easier to write a shopping list for the required
ingredients.
</content>
</entry>
<entry>
<title>Switch to http.Handler</title>
<updated>2024-10-23T18:34:57Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-10-23T18:34:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=e66691083a2455c29b50a2970c0aba1d6afca753'/>
<id>urn:sha1:e66691083a2455c29b50a2970c0aba1d6afca753</id>
<content type='text'>
The used `func(http.ResponseWriter, *http.Request)` return values made
the HTTP handler factory functions quite unreadable. Thus it is switched
to the http.Handler type.
</content>
</entry>
<entry>
<title>Remove github.com/gorilla/mux dependency</title>
<updated>2024-10-22T19:53:30Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-10-22T19:17:47Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=dbc874e2b9f300bea7a18deda32e784afb0ab89a'/>
<id>urn:sha1:dbc874e2b9f300bea7a18deda32e784afb0ab89a</id>
<content type='text'>
The reason for the introduction of this dependency was that it was easy
to setup routes with HTTP method restrictions.

Since Go 1.22 this feature is part of the standard library. Method
restrictions are part of the patterns used to register routes [1].

[1]: https://pkg.go.dev/net/http#hdr-Patterns-ServeMux
</content>
</entry>
<entry>
<title>model: Replace global db variable by custom type</title>
<updated>2024-10-13T17:55:38Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-10-13T17:52:28Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=473052ed8f2c83052ed5b47a7f4cec68ac2621a6'/>
<id>urn:sha1:473052ed8f2c83052ed5b47a7f4cec68ac2621a6</id>
<content type='text'>
Reducing global variables makes it easier to understand functions
independently of the rest of the code.

Adding the new model.DB type as a custom variant of the sql.DB type
makes it possible to write methods for the database which makes the code
way more readable.
</content>
</entry>
<entry>
<title>model: Fix direct access to database</title>
<updated>2024-10-12T13:24:33Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-17T20:49:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=9d3a5fb85dc02e87fab879855c4c3bace5f753f2'/>
<id>urn:sha1:9d3a5fb85dc02e87fab879855c4c3bace5f753f2</id>
<content type='text'>
Instead a database transaction has to be used. Each database interaction
should be wrapped into a transaction to make sure any possible change
(even side-effects) can be rolled back in case of errors.
</content>
</entry>
<entry>
<title>Apply go fmt to all source files</title>
<updated>2024-09-11T18:25:54Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-09-11T18:25:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=54029aac92f17ec87d3ef0bb73fcdac271b209c9'/>
<id>urn:sha1:54029aac92f17ec87d3ef0bb73fcdac271b209c9</id>
<content type='text'>
This applies default Go code style recommendations.
</content>
</entry>
<entry>
<title>view: Fix time stamp bug</title>
<updated>2024-05-17T15:14:35Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-17T15:06:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=0416f520cff9716792ac0f3ade5f71187d07ac2e'/>
<id>urn:sha1:0416f520cff9716792ac0f3ade5f71187d07ac2e</id>
<content type='text'>
The recipe edit page HTML template did not contain the two time stamps
"Created" and "LastChanged" as hidden form values.

Thus the information was not passed from the backend to the frontend. On
a save the recipe without time stamp information was injected into the
backend.

This effectively deleted any time stamp information. This commit fixes
that bug by including all fields of the model.Recipe struct inside the
form of the recipe-edit.html template.
</content>
</entry>
<entry>
<title>view: Use number input for ingredient amount</title>
<updated>2024-05-17T15:14:29Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-17T13:51:45Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=c61e45a5a260d9804ebc4f54814edf1e1b471ac3'/>
<id>urn:sha1:c61e45a5a260d9804ebc4f54814edf1e1b471ac3</id>
<content type='text'>
This accepts only real numbers with a minimum step of 0.001 as input for
the amount field of a recipe ingredient.

The browser has the chance to give the user direct feedback that a
non-numeric string will not work.
</content>
</entry>
<entry>
<title>view: Remove empty ingredient summaries</title>
<updated>2024-05-15T18:42:09Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T18:42:09Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=d14aece3295405b4377ea20aabd9c621aace4922'/>
<id>urn:sha1:d14aece3295405b4377ea20aabd9c621aace4922</id>
<content type='text'>
If the recipe has no ingredients at all the "Ingredient summary:" text
used to be displayed. This is not useful and confusing. It is removed
with this commit.
</content>
</entry>
<entry>
<title>view: Require text for steps</title>
<updated>2024-05-15T17:39:17Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T17:39:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=34880a0194f66e2b1808b45abfb01497d4816aaf'/>
<id>urn:sha1:34880a0194f66e2b1808b45abfb01497d4816aaf</id>
<content type='text'>
It does not make sense to add empty steps.
</content>
</entry>
<entry>
<title>view: Require ingredient type</title>
<updated>2024-05-15T17:37:05Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T17:37:05Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=29c8c305c52b97248e505cdfc6b86e96f57d0a53'/>
<id>urn:sha1:29c8c305c52b97248e505cdfc6b86e96f57d0a53</id>
<content type='text'>
It does make sense to add an ingredient only with a type and no amount
or unit like 'salt'. But it does not make sense to add an ingredient
without a type like '5' or '2 l'.
</content>
</entry>
<entry>
<title>view: Update to simple.css v2.3.0</title>
<updated>2024-05-15T17:33:11Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T17:33:11Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=45a0a10c070e3dba33be01d4de4d094fd7f7394a'/>
<id>urn:sha1:45a0a10c070e3dba33be01d4de4d094fd7f7394a</id>
<content type='text'>
This is the latest available release. Updated to keep up to date and
adopt fixes.
</content>
</entry>
<entry>
<title>view: Rename to 'Ingredient summary:'</title>
<updated>2024-05-15T17:27:05Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T17:27:05Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=b48f4514a44450da1ad5da68ce434c2b87e721d0'/>
<id>urn:sha1:b48f4514a44450da1ad5da68ce434c2b87e721d0</id>
<content type='text'>
This used to be named 'Ingredients: which might be confusing since
ingredients are defined per step and the list at the top of the recipe
is just a summary.
</content>
</entry>
<entry>
<title>When adding a recipe step or an ingredient the browser should focus on</title>
<updated>2024-05-15T17:20:01Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-15T17:20:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=d8b40f0a0a2ac2bcb8b9b690166ae7594c067298'/>
<id>urn:sha1:d8b40f0a0a2ac2bcb8b9b690166ae7594c067298</id>
<content type='text'>
the first text input of that new element.

This supports using Ceres without a mouse and only with tab-based
navigation with a keyboard.
</content>
</entry>
<entry>
<title>view: Complete ingredient editing</title>
<updated>2024-05-14T18:43:41Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-14T18:14:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=a87128138bdb301ede64049ec5068e47abb5c839'/>
<id>urn:sha1:a87128138bdb301ede64049ec5068e47abb5c839</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Add HTML for editing recipe ingredients</title>
<updated>2024-05-13T19:52:48Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-13T19:51:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=b5b72880a0b6e9f188b532c9b2ad360ff1dab2ea'/>
<id>urn:sha1:b5b72880a0b6e9f188b532c9b2ad360ff1dab2ea</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Add ingredient overview to recipe read page</title>
<updated>2024-05-12T18:52:25Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-07T10:04:11Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=bf328dd38a28cf44cfa81c7f1dcd95936d2d0301'/>
<id>urn:sha1:bf328dd38a28cf44cfa81c7f1dcd95936d2d0301</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Show ingredients on read page</title>
<updated>2024-05-12T18:52:25Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-07T09:56:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=01d97189d245300d65ca31d650dd868d1d1fc0d8'/>
<id>urn:sha1:01d97189d245300d65ca31d650dd868d1d1fc0d8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Use HTML template to add recipe steps</title>
<updated>2024-05-12T18:38:24Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-12T18:38:24Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=fec2fea87615e6ee3a6e73f7f98e021eee1b7098'/>
<id>urn:sha1:fec2fea87615e6ee3a6e73f7f98e021eee1b7098</id>
<content type='text'>
This makes the JS function way simpler and removes a duplication of the
step HTML code.
</content>
</entry>
<entry>
<title>view: Create new html/recipe-step.html</title>
<updated>2024-05-12T18:20:14Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-12T18:20:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=64ece1c4455ed6f8e8be5cb8f060f14b6131823f'/>
<id>urn:sha1:64ece1c4455ed6f8e8be5cb8f060f14b6131823f</id>
<content type='text'>
This allows to use it in two places:

- template for loop for backend-generated steps
- a HTML template tag for frontend- / JS-generated steps
</content>
</entry>
<entry>
<title>view: Move all JS code to static/ceres.js</title>
<updated>2024-05-12T18:06:17Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-12T18:06:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=f2800e8289e9637bb3227a5f9622edabf6529b0f'/>
<id>urn:sha1:f2800e8289e9637bb3227a5f9622edabf6529b0f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Remove global JS code in recipe-edit.html</title>
<updated>2024-05-12T18:01:02Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-12T18:01:02Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=cfeff398f0ad7e4205dc26b66ca2b46ebca24606'/>
<id>urn:sha1:cfeff398f0ad7e4205dc26b66ca2b46ebca24606</id>
<content type='text'>
This makes it impossible to move the whole JS functionality into the
central ceres.js script. Moving that JS code there makes caching
possible and bundles all JS-related code in one file.

The overall goal is to get rid of as many JS code as possible.
</content>
</entry>
<entry>
<title>view: Add unit test for index handler</title>
<updated>2024-05-11T21:08:42Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-11T21:08:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=907bd7e63f4cf3cb01bc678e09fc5b8962afe750'/>
<id>urn:sha1:907bd7e63f4cf3cb01bc678e09fc5b8962afe750</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Fix cancel button on recipe create</title>
<updated>2024-05-09T10:19:35Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-23T16:47:30Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=a2aa866e630c45e1db4fadbb20cb1a9d24384a79'/>
<id>urn:sha1:a2aa866e630c45e1db4fadbb20cb1a9d24384a79</id>
<content type='text'>
</content>
</entry>
<entry>
<title>view: Replace HTML form labels by placeholders</title>
<updated>2024-05-09T10:19:35Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-23T15:42:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=eb000e0cc514ebca753970ddb9135e09cb885d7a'/>
<id>urn:sha1:eb000e0cc514ebca753970ddb9135e09cb885d7a</id>
<content type='text'>
This takes up way less space in the code and the actual user view.
</content>
</entry>
<entry>
<title>Remove default recipe name</title>
<updated>2024-05-09T10:19:30Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-23T15:42:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=2704cb76554b02f546bf3f9d2d11be98f2854b7b'/>
<id>urn:sha1:2704cb76554b02f546bf3f9d2d11be98f2854b7b</id>
<content type='text'>
To avoid not clickable recipes on the /recipes page a default name used
to be inserted on recipe creation.

This was not a proper fix for the problem and also was annoying that the
user first had to remove the default recipe name.

This commit removes this default name.
</content>
</entry>
<entry>
<title>view: Enforce recipe titles</title>
<updated>2024-05-09T10:07:48Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-04-22T19:51:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=c5e7551dc2da9798ff51d91aa238098f5ac4605f'/>
<id>urn:sha1:c5e7551dc2da9798ff51d91aa238098f5ac4605f</id>
<content type='text'>
In addition to the enforcement of titles in the model package the HTML
form field for the title is set to 'required' to give the user feedback
via the browser that a title is required.
</content>
</entry>
<entry>
<title>Introduce model.Transaction()</title>
<updated>2024-05-08T20:26:00Z</updated>
<author>
<name>xengineering</name>
<email>me@xengineering.eu</email>
</author>
<published>2024-05-08T19:53:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit.xengineering.eu/ceres/commit/?id=0ba1a7661a81200db98e40149eef1e39fd22f407'/>
<id>urn:sha1:0ba1a7661a81200db98e40149eef1e39fd22f407</id>
<content type='text'>
It is a very common pattern that some function needs to access the
database and wants to wrap all the actions into one transaction.

The advantage of a transaction is that it is ACID:

- atomic
- consistent
- isolated
- durable

In Go it is required to request a new transaction, execute functionality
on it and handle rollback or commit of this transaction based on the
success of the operation.

All this and the error handling can be written down in the
model.Transaction() function exactly once. The full signature of it is:

	func Transaction(f func(*sql.Tx) error) error

It requires a function or closure passed as argument which takes the
transaction (*sql.Tx) and returns an error which might be nil.

This is very generic. It is applied to:

- injecting test data
- database migrations
- data read requests
- data write requests
</content>
</entry>
</feed>
