Add app version to default stashed values.

This means that the version no longer needs to be passed to every version
manually, and is automatically populated in templates where the parameter is
not explicitly provided.
This commit is contained in:
Molly Miller 2023-06-12 20:46:10 +02:00
parent 0516344ac0
commit beb59221e7
4 changed files with 3 additions and 19 deletions

View file

@ -72,6 +72,7 @@ sub startup {
} }
chomp $self->config->{version}; chomp $self->config->{version};
$self->defaults(version => $self->config->{version} // 'UNKNOWN');
$self->plugin( $self->plugin(
authentication => { authentication => {

View file

@ -207,7 +207,6 @@ sub profile {
journey => $status, journey => $status,
journey_visibility => $visibility, journey_visibility => $visibility,
journeys => [@journeys], journeys => [@journeys],
version => $self->app->config->{version} // 'UNKNOWN',
); );
} }

View file

@ -8,15 +8,13 @@ use Mojo::Base 'Mojolicious::Controller';
sub about { sub about {
my ($self) = @_; my ($self) = @_;
$self->render( 'about', $self->render('about');
version => $self->app->config->{version} // 'UNKNOWN' );
} }
sub changelog { sub changelog {
my ($self) = @_; my ($self) = @_;
$self->render( 'changelog', $self->render('changelog');
version => $self->app->config->{version} // 'UNKNOWN' );
} }
sub imprint { sub imprint {

View file

@ -398,8 +398,6 @@ sub homepage {
my ( $connecting_trains, $transit_fyi ) = @_; my ( $connecting_trains, $transit_fyi ) = @_;
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version}
// 'UNKNOWN',
user_status => $status, user_status => $status,
journey_visibility => $journey_visibility, journey_visibility => $journey_visibility,
connections => $connecting_trains, connections => $connecting_trains,
@ -412,8 +410,6 @@ sub homepage {
sub { sub {
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version}
// 'UNKNOWN',
user_status => $status, user_status => $status,
journey_visibility => $journey_visibility, journey_visibility => $journey_visibility,
); );
@ -426,7 +422,6 @@ sub homepage {
else { else {
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version} // 'UNKNOWN',
user_status => $status, user_status => $status,
journey_visibility => $journey_visibility, journey_visibility => $journey_visibility,
); );
@ -441,7 +436,6 @@ sub homepage {
} }
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version} // 'UNKNOWN',
user_status => $status, user_status => $status,
recent_targets => \@recent_targets, recent_targets => \@recent_targets,
with_autocomplete => 1, with_autocomplete => 1,
@ -452,7 +446,6 @@ sub homepage {
else { else {
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version} // 'UNKNOWN',
intro => 1 intro => 1
); );
} }
@ -899,8 +892,6 @@ sub station {
can_check_out => $can_check_out, can_check_out => $can_check_out,
connections => $connecting_trains, connections => $connecting_trains,
title => "travelynx: $status->{station_name}", title => "travelynx: $status->{station_name}",
version => $self->app->config->{version}
// 'UNKNOWN',
); );
} }
)->catch( )->catch(
@ -915,8 +906,6 @@ sub station {
user_status => $user_status, user_status => $user_status,
can_check_out => $can_check_out, can_check_out => $can_check_out,
title => "travelynx: $status->{station_name}", title => "travelynx: $status->{station_name}",
version => $self->app->config->{version}
// 'UNKNOWN',
); );
} }
)->wait; )->wait;
@ -932,7 +921,6 @@ sub station {
user_status => $user_status, user_status => $user_status,
can_check_out => $can_check_out, can_check_out => $can_check_out,
title => "travelynx: $status->{station_name}", title => "travelynx: $status->{station_name}",
version => $self->app->config->{version} // 'UNKNOWN',
); );
} }
} }
@ -942,7 +930,6 @@ sub station {
if ( ref($err) eq 'HASH' ) { if ( ref($err) eq 'HASH' ) {
$self->render( $self->render(
'landingpage', 'landingpage',
version => $self->app->config->{version} // 'UNKNOWN',
with_autocomplete => 1, with_autocomplete => 1,
with_geolocation => 1, with_geolocation => 1,
error => $err->{errstr}, error => $err->{errstr},
@ -1296,7 +1283,6 @@ sub year_in_review {
$self->render( $self->render(
'year_in_review', 'year_in_review',
version => $self->app->config->{version} // 'UNKNOWN',
title => "travelynx Jahresrückblick $year", title => "travelynx Jahresrückblick $year",
year => $year, year => $year,
stats => $stats, stats => $stats,