From aba7207168885c1f2cf32d461338b4cc8d071d34 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 29 Dec 2025 16:31:43 +0100 Subject: sort full history in chronological order (ascending by time) This feels more intuitive. The snippet on the landing page remains in reverse chronological order (descending by time). --- lib/Travelynx/Controller/Traveling.pm | 2 + lib/Travelynx/Model/Journeys.pm | 7 ++- sass/src/common/local.scss | 31 +++++++--- templates/_history_trains.html.ep | 105 ++++++++++++++++++++++------------ templates/history_by_month.html.ep | 2 +- templates/history_by_year.html.ep | 2 +- templates/landingpage.html.ep | 2 +- 7 files changed, 104 insertions(+), 47 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 28d7bfd..da889f0 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -1582,6 +1582,7 @@ sub yearly_history { uid => $self->current_user->{id}, after => $interval_start, before => $interval_end, + sort => 'asc', with_datetime => 1 ); @@ -1664,6 +1665,7 @@ sub monthly_history { uid => $self->current_user->{id}, after => $interval_start, before => $interval_end, + sort => 'asc', with_datetime => 1 ); diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index 40ccfa8..d49c03d 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -698,9 +698,14 @@ sub get { user_id => $uid, cancelled => 0 ); + + my $order_key = '-desc'; + if ( $opt{sort} and $opt{sort} eq 'asc' ) { + $order_key = '-asc'; + } my %order = ( order_by => { - -desc => 'real_dep_ts', + $order_key => 'real_dep_ts', } ); diff --git a/sass/src/common/local.scss b/sass/src/common/local.scss index 9c03675..c0552eb 100644 --- a/sass/src/common/local.scss +++ b/sass/src/common/local.scss @@ -163,15 +163,30 @@ ul.route-history > li { } // route icon bubble - i.material-icons { - &[aria-label=nach] { - padding-top: 0.4rem; + &.order-asc { + i.material-icons { + &[aria-label=von] { + display: block; + transform: rotate(90deg); + height: 1rem; + margin-top: 0.4rem; + } + &[aria-label=nach] { + padding-top: 0.4rem; + } } - &[aria-label=von] { - display: block; - transform: rotate(-90deg); - height: 1rem; - margin-top: 0.4rem; + } + &.order-desc { + i.material-icons { + &[aria-label=nach] { + padding-top: 0.4rem; + } + &[aria-label=von] { + display: block; + transform: rotate(-90deg); + height: 1rem; + margin-top: 0.4rem; + } } } diff --git a/templates/_history_trains.html.ep b/templates/_history_trains.html.ep index 0a9abd5..3550c79 100644 --- a/templates/_history_trains.html.ep +++ b/templates/_history_trains.html.ep @@ -27,44 +27,79 @@ -