From eb929811b227790553265cdd4125cc17b4c7f1a6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 27 Mar 2019 21:46:52 +0100 Subject: [PATCH] add per-month links to history --- lib/Travelynx/Controller/Traveling.pm | 3 ++- templates/history.html.ep | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index f409b44..3f5a181 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -300,7 +300,8 @@ sub monthly_history { template => 'history', journeys => [@journeys], year => $year, - month => $months[ $month - 1 ], + month => $month, + month_name => $months[ $month - 1 ], statistics => $stats } ); diff --git a/templates/history.html.ep b/templates/history.html.ep index 6b0f894..2808660 100644 --- a/templates/history.html.ep +++ b/templates/history.html.ep @@ -1,5 +1,22 @@ +% my $since = get_user_data()->{registered_at}; +% my $now = DateTime->now(time_zone => 'Europe/Berlin'); +
+
+
    + + % my $ref = stash('year') ? stash('year') . '/' . stash('month') : ''; + % while ($since < $now) { + % my $link_to = $since->strftime('%Y/%m'); + % my $class = $link_to eq $ref ? 'active' : 'waves-effect'; +
  • <%= $since->strftime('%m.%Y') %>
  • + % $since->add(months => 1); + % } + +
+
+
% if (my $stats = stash('statistics')) { -

<%= stash('month') %> <%= stash('year') %>

+

<%= stash('month_name') %> <%= stash('year') %>