From 5b3cfd33551deb4ede6ee4e07db95a0570fb412a Mon Sep 17 00:00:00 2001 From: Cassidy Dingenskirchen Date: Mon, 22 Jan 2024 18:53:27 +0100 Subject: [PATCH] add title elements (cherry picked from commit 5d8f6467dc00f03957784230983ed730ec421291) Signed-off-by: Birte Kristina Friesel --- lib/Travelynx/Controller/Profile.pm | 3 +++ lib/Travelynx/Controller/Static.pm | 8 ++++---- lib/Travelynx/Controller/Traewelling.pm | 1 + lib/Travelynx/Controller/Traveling.pm | 15 ++++++++++++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/Travelynx/Controller/Profile.pm b/lib/Travelynx/Controller/Profile.pm index 03f3b0d..f14ea97 100755 --- a/lib/Travelynx/Controller/Profile.pm +++ b/lib/Travelynx/Controller/Profile.pm @@ -154,6 +154,7 @@ sub profile { $self->render( 'profile', + title => "travelynx: $name", name => $name, uid => $user->{id}, privacy => $user, @@ -313,6 +314,7 @@ sub journey_details { } $self->render( 'journey', + title => "travelynx: $title", error => undef, journey => $journey, with_map => 1, @@ -470,6 +472,7 @@ sub user_status { any => { template => 'user_status', name => $name, + title => "travelynx: $tw_data{title}", privacy => $user, journey => $status, twitter => \%tw_data, diff --git a/lib/Travelynx/Controller/Static.pm b/lib/Travelynx/Controller/Static.pm index c91630e..1be444f 100644 --- a/lib/Travelynx/Controller/Static.pm +++ b/lib/Travelynx/Controller/Static.pm @@ -8,25 +8,25 @@ use Mojo::Base 'Mojolicious::Controller'; sub about { my ($self) = @_; - $self->render('about'); + $self->render('about', title => 'Über travelynx'); } sub changelog { my ($self) = @_; - $self->render('changelog'); + $self->render('changelog', title => 'travelynx: Changelog'); } sub imprint { my ($self) = @_; - $self->render('imprint'); + $self->render('imprint', title => 'travelynx: Impressum'); } sub legend { my ($self) = @_; - $self->render('legend'); + $self->render('legend', title => 'travelynx: Legende' ); } sub offline { diff --git a/lib/Travelynx/Controller/Traewelling.pm b/lib/Travelynx/Controller/Traewelling.pm index 6c38f7a..c9e89bb 100644 --- a/lib/Travelynx/Controller/Traewelling.pm +++ b/lib/Travelynx/Controller/Traewelling.pm @@ -144,6 +144,7 @@ sub settings { $self->param( tweet => 1 ); } + $self->stash ( title => 'travelynx × träwelling' ); $self->render( 'traewelling', traewelling => $traewelling, diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index d92137b..bc42c32 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -1185,7 +1185,7 @@ sub cancelled { sub history { my ($self) = @_; - $self->render( template => 'history' ); + $self->render( template => 'history', title => 'travelynx: History' ); } sub commute { @@ -1293,6 +1293,7 @@ sub commute { journeys_by_month => \%journeys_by_month, count_by_month => \%count_by_month, total_journeys => $total, + title => 'travelynx: Reisen nach Station', months => [ qw(Januar Februar März April Mai Juni Juli August September Oktober November Dezember) ], @@ -1390,6 +1391,7 @@ sub map_history { template => 'history_map', year => $year, with_map => 1, + title => 'travelynx: Karte', %{$res} ); } @@ -1515,7 +1517,7 @@ sub year_in_review { $self->render( 'year_in_review', - title => "travelynx Jahresrückblick $year", + title => "travelynx: Jahresrückblick $year", year => $year, stats => $stats, review => $review, @@ -1586,6 +1588,7 @@ sub yearly_history { }, any => { template => 'history_by_year', + title => "travelynx: $year", journeys => [@journeys], year => $year, have_review => $with_review, @@ -1649,6 +1652,8 @@ sub monthly_history { month => $month ); + my $month_name = $months[ $month - 1 ]; + $self->respond_to( json => { json => { @@ -1658,10 +1663,11 @@ sub monthly_history { }, any => { template => 'history_by_month', + title => "travelynx: $month_name $year", journeys => [@journeys], year => $year, month => $month, - month_name => $months[ $month - 1 ], + month_name => $month_name, statistics => $stats } ); @@ -1736,6 +1742,9 @@ sub journey_details { $self->render( 'journey', + title => sprintf( 'travelynx: %s %s %s am %s', + $journey->{type}, $journey->{line} // '', $journey->{no}, + $journey->{sched_arrival}->strftime('%d.%m.%Y, %H:%M') ), error => undef, journey => $journey, journey_visibility => $visibility,