Elements with this class are only shown when JS is available, i.e. they
are (mostly) the opposite of the noscript element.
This replaces the previous implementation to do that, which was itself
based on JavaScript. It is now reusable, declarative and easier to grasp
at a glance.
As the entire site is built on JS this likely won't be used much beyond
its single current invocation.
The rules not changing after a game has started is a invariant of the
`Game` model, not the `Session` model. As such, it should enforce it
itself, instead of relying on its users.
By main buttons I mean the "new game", "they win" and "we win" buttons.
They have in common that they scroll to the bottom of the view, to make
sure the user can immediately see their effect.
This change fixes two bugs:
1. The scrolling did not work reliably. While it would always scroll a
bit, it would usually not go to the bottom exactly. This meant that
most of the time the bottom digits were only half visible. Now it
scrolls reliably all the way.
2. When hitting the win buttons in rapid succession it was possible to
trigger both within a single redraw cycle. This caused the UI to set
a single rounds winner to both teams, which the round model rightly
rejected. Now, by the time the second event is registered, the button
has already been disabled, or the round been replaced by a new one.
This improves the design of the session view a lot. However, several
things still need to be done:
1. The rules section is not styled.
2. The session list is not styled.
3. The design is not responsive yet. This will take longer, as the base
view will need to be overhauled substantially to take advantage of
wider screens.
4. A light mode needs to be added.
This is a more flexible system than the previous goal variable. It makes
it possible to conform to the association rules, without sacrificing
backwards compatibility. Also, it makes it easier to add other
changeable rules later on.
The base view now does a better job at keeping the sessions list up to
date with the current session, without having to reload it all the time.
The purpose of this is to be able to show the list and the current
session at the same time, and keep them in sync without polling the
database.
The previous implementation only looked at the URL (and state) during
initialization. This allowed users to open a specific session via URL
(e.g. when reloading the page).
History navigation, however, was completely ignored. I.e. if the user
pressed the back button the URL would change, but the content would
remain the same.
This has now been corrected.
The purpose of this is data safety. If there ever was a broken model
that corrupted data previously it would have ruined everything if it
coincided with a schema migration. Now this is much less likely.
This will be needed for database upgrades going forward. For example, an
old session without an update timestamp will not be visible in the index
that will soon be added. But since the UI will switch to that index, it
is paramount that all sessions are part of that.
The session model was built with that in mind, and has the corresponding
"update" logic. However, for that to matter old records first need to be
readded to the database.