Commit graph

9 commits

Author SHA1 Message Date
76de321d41 templates: Don't show the tagging form if no tags
If there are no tags but the form is still shown, the admin
could ask to add an empty tag returning an error 422
unprocessable entity.
Remove if there are no tags available
2024-08-01 22:55:44 +01:00
4d5a423c78 template: Add anchor link to the editable truths
For some reason I did not add the anchor links to the editable truths
for the admin users.
Add them so that the admin can benefit as well.
2024-08-01 22:45:40 +01:00
322d37ce48 templates: Remove the extra / in the anchor link
Anchor links do not need an additional / to work : the # can be added directly
at the end of the previous URL.
Remove it from the existing anchor tags in the truths.
2024-08-01 22:43:25 +01:00
19898e1b09 tag: Introduce tag system
Create a new table representing tags, composed of a name and color.
They can be used to tag truths and filter them later.
Tags display under the truths they correspond to and can be clicked
to access all truths matching this tag.

Introduce a new element in the top bar to allow navigating to the
tag list, which can be used to create and edit tags for the admin
and used to select a list of tags to filter against for everyone.

Update the database records of the truths to include the tag vector.
As the database query result is a multi-row result, it cannot be
parsed automatically so it needs to be skipped and retrieved
manually.
2024-08-01 21:55:47 +01:00
072889173f week: Add week number to the DisplayTruth
In order to have all the relevant information for displaying a truth everywhere, add
its week number.
Fetch it during the week rendering and use it for the link back.
2024-07-29 22:54:13 +01:00
4e1e9facc6 tempaltes/truth: Add an anchor and link to each truth
Users might want to share specific truths, or it might be useful to link to them in the future.
Set the id of the h3 element for each truth to its number in the week and add an anchor link to
the full h3 element, to be able to click anywhere.

Update the stylesheet to hide the link color and decorations, add animation an hover color as
with the week navigation arrows.
2024-07-29 22:34:43 +01:00
1b4a934398 auth: Split off vote data from the user
Now that the application is going to have multiple pages, vote data makes no sense
to keep with the user.
The user struct will be used everywhere to check for authentication, which is not
the case for previous votes.

Create a new struct and function in src/vote.rs to retrieve existing votes and
use them in places where user.votes was used previously.
Remove vote-related code from src/auth.rs and the week number dependence that it
required.
2024-07-28 16:55:22 +01:00
b1f37a4e4a templates: Make the index a class
The index is a full HTML page with some boilerplate that would be needed in all
pages deviating from the truth list, specifically the head and general structure.

Make the core structure a base template, rebuild the week index page inheriting
from it.
Change which template is used by the route accordingly.
2024-07-28 16:55:18 +01:00
afdac98dea templates: Move week-related includes to a folder
In preparation to adding a new page, move the week-related included files in a specific
sub-folder.
Change includes accordingly.
2024-07-27 22:41:06 +01:00