derf / travelynx

Traewelling-inspired journey logger with realtime data
https://travelynx.de
GNU Affero General Public License v3.0
117 stars 18 forks source link

Add version string to default template parameters #74

Closed sysvinit closed 1 year ago

sysvinit commented 1 year ago

Some pages don't display the version string correctly in the page footer. For example, /login on travelynx.de currently shows "travelynx v???" in the page footer:

screenshot

The template for the login page includes the _footer template fragment, and explicitly passes through the version parameter from the request stash: https://github.com/derf/travelynx/blob/0516344ac09214ca8dde0fe0d9fa7b7832213ef0/templates/login.html.ep#L101

However, when this template is rendered in this request handler, the version parameter is never explicitly provided: https://github.com/derf/travelynx/blob/0516344ac09214ca8dde0fe0d9fa7b7832213ef0/lib/Travelynx/Controller/Account.pm#L235-L238

As there is no default value set in the request stash, this results in the placeholder text "???" being used instead: https://github.com/derf/travelynx/blob/0516344ac09214ca8dde0fe0d9fa7b7832213ef0/templates/_footer.html.ep#L3

This PR sets a default value for the version field of the request stash, so that this parameter is automatically set when rendering pages. As this parameter no longer needs to be passed explicitly, this PR also removes all occurrences of the explicit version parameter in existing page handlers.

derf commented 1 year ago

Thanks! :)