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
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.
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.
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.
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.
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.
Now that we have the name of the world, we can show it in the title.
The base I used supposed an english language page, which is incorrect here.
Set language as French.
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.
Static files served with FileServer have a low priority : all other possible routes
a this root will be checked first, before they get returned.
As we have a lot of routes at the root, they will be hit a lot before we get
to the static files.
Move the static files to a dedicated path to reduce those internal redirections,
update the paths in the HTML and add one for the favicon so it continues to work.
Add a logout button that clears the auth cookies, logging out the user.
It also tries to remove the auth token from the databse, but will ignore
any error during the database operation.
Do some include clean-ups as well.
Currently, if all votes are cast and the week is locked the selections are disabled but
the form and button still exist and might cause confusion.
Remove them if all votes are cast and we are not on the last week anymore.
Previously, most redirects targeted the root of the application.
This was okay for the first part of development where only one week would be
active, but would be annoying when using multiple weeks.
Change those redirects to call week::week.
Change the login path to be dependant on the current week as well,
so it can be correctly redirected.
Implement a way for admins to introduce new weeks and set them as the last active one.
The last active week is the last one that is accessible to players, and will also prevent
the graph from being displayed.
Implement arrows for navigating between the weeks in the HTML.
I made a choice to only log confirmed votes : there is no blank vote in the database.
This means that when fetching a user's vote, if they have not voted for everyone
there will be votes missing.
As this is sent to the templating engine via a Vector, the ordering of the votes
will be incorrect : all existing votes will follow each other, and there will be
missing votes at the end.
Update the select logic in the truth template to account for that by checking
the truth_id directly, rather than via the index of the array. (O(N²)...)
Remove 'has_vote' as this is not useful anymore.
- Create a new migration adding a Weeks table, allowing for new weekly introductions
and paving the way for multiple week handling.
- Add route to update the weekly introduction
- Move the week rendering to a specific week file
- Update the templates to use the week number from the week data
- Update templates to render and edit weekly introductions
This first version allows login of pre-existing users, creation and update of truths
by admins, vote on the truths by users, their display as well as a simple graph
for the vote results.
Everything persisting in a SQLite database.