From ccfdd8007e136d5d98652d415dda8eb595a2ada9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 21 Nov 2020 15:33:43 +0100 Subject: testing a more organized history navigation --- templates/_history_months.html.ep | 21 ++++++++++++++++----- templates/_history_months_for_year.html.ep | 16 ++++++++++++++++ templates/_history_years.html.ep | 22 ++++++++++++++-------- templates/account.html.ep | 8 ++++---- templates/history.html.ep | 27 +-------------------------- templates/history_by_month.html.ep | 4 +--- templates/history_by_year.html.ep | 4 ++-- templates/layouts/default.html.ep | 2 +- 8 files changed, 55 insertions(+), 49 deletions(-) create mode 100644 templates/_history_months_for_year.html.ep (limited to 'templates') diff --git a/templates/_history_months.html.ep b/templates/_history_months.html.ep index a707943..2dc0141 100644 --- a/templates/_history_months.html.ep +++ b/templates/_history_months.html.ep @@ -1,12 +1,23 @@
    - % for my $month (journeys->get_months(uid => current_user->{id})) { - % my $link_to = $month->[0]; - % my $text = $month->[1]; - % my $class = $link_to eq $current ? 'active' : 'waves-effect'; -
  • <%= $text %>
  • + % my ($prev, $current, $next) = journeys->get_nav_months(uid => current_user->{id}, year => $year, month => $month); + % if ($prev) { +
  • chevron_left
  • % } + % else { +
  • chevron_left
  • + % } + % if ($current) { +
  • <%= $current->[1] %>
  • + % } + % if ($next) { +
  • chevron_right
  • + % } + % else { +
  • chevron_right
  • + % } +
  • <%= $year %>
diff --git a/templates/_history_months_for_year.html.ep b/templates/_history_months_for_year.html.ep new file mode 100644 index 0000000..c6a64de --- /dev/null +++ b/templates/_history_months_for_year.html.ep @@ -0,0 +1,16 @@ +
+
+
+ % for my $month (journeys->get_months_for_year(uid => current_user->{id}, year => $year)) { + % if (defined $month->[2]) { + <%= $month->[1] %> + <%= sprintf('%.f', $month->[2]{km_route}) %> km + + % } + % else { +
<%= $month->[1] %>
+ % } + % } +
+
+
diff --git a/templates/_history_years.html.ep b/templates/_history_years.html.ep index e0b1357..09ea5ce 100644 --- a/templates/_history_years.html.ep +++ b/templates/_history_years.html.ep @@ -1,12 +1,18 @@
-
    - % for my $year (journeys->get_years(uid => current_user->{id})) { - % my $link_to = $year->[0]; - % my $text = $year->[1]; - % my $class = $link_to eq $current ? 'active' : 'waves-effect'; -
  • <%= $text %>
  • - % } -
+ % my @years = journeys->get_years(uid => current_user->{id}); + % if (@years) { +
    + % for my $year (journeys->get_years(uid => current_user->{id})) { + % my $link_to = $year->[0]; + % my $text = $year->[1]; + % my $class = $link_to eq $current ? 'active' : 'waves-effect'; +
  • <%= $text %>
  • + % } +
+ % } + % else { + Keine Fahrten gefunden. + % }
diff --git a/templates/account.html.ep b/templates/account.html.ep index 63dde38..dd7b11a 100644 --- a/templates/account.html.ep +++ b/templates/account.html.ep @@ -31,13 +31,13 @@ % } -

Account

% my $acc = current_user(); % my $hook = get_webhook(); % my $traewelling = traewelling->get($acc->{id}); % my $use_history = users->use_history(uid => $acc->{id});
+

Account

@@ -159,10 +159,10 @@ -

API

% my $token = get_api_token();
+

API

Die folgenden API-Token erlauben den passwortlosen automatisierten Zugriff auf API-Endpunkte. Bitte umsichtig behandeln – sobald ein Token gesetzt @@ -273,10 +273,10 @@

-

Export

+

Export

  • Rohdaten (Kein API-Ersatz, das Format kann sich jederzeit ändern)
@@ -284,9 +284,9 @@
% if (not $acc->{deletion_requested}) { -

Löschen

+

Löschen

Der Löschauftrag wird vorgemerkt und erst nach drei Tagen umgesetzt, bis dahin kann er jederzeit zurückgenommen werden. Nach diff --git a/templates/history.html.ep b/templates/history.html.ep index 3751741..1752000 100644 --- a/templates/history.html.ep +++ b/templates/history.html.ep @@ -1,31 +1,6 @@ -

Fahrten

+

Fahrten

-
-
- Hier finden sich alle bisherigen Zugfahrten und Statistiken für jedes - Jahr und jeden Monat. -
-
- -

Nach Jahr

%= include '_history_years', current => ''; -% if(0) { -
-
- Noch keine Fahrten. -
-
-% } - -

Nach Monat

-%= include '_history_months', current => ''; -% if(0) { -
-
- Noch keine Fahrten. -
-
-% }

Auswertungen

diff --git a/templates/history_by_month.html.ep b/templates/history_by_month.html.ep index 7aae59d..9ad7031 100644 --- a/templates/history_by_month.html.ep +++ b/templates/history_by_month.html.ep @@ -1,6 +1,4 @@ -%= include '_history_months', current => "${year}/${month}"; - -

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

+%= include '_history_months'; % if (stash('statistics')) { %= include '_history_stats', stats => stash('statistics'); diff --git a/templates/history_by_year.html.ep b/templates/history_by_year.html.ep index c5cffa0..a112258 100644 --- a/templates/history_by_year.html.ep +++ b/templates/history_by_year.html.ep @@ -1,10 +1,10 @@ %= include '_history_years', current => $year; -

Jahresrückblick <%= $year %>

- % if (stash('statistics')) { %= include '_history_stats', stats => stash('statistics'); % } +% +%= include '_history_months_for_year'; % if (stash('journeys')) { %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'); diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 06ca305..5ecd801 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -13,7 +13,7 @@ % while (my ($key, $value) = each %{stash('opengraph') // {}}) { % } - % my $av = 'v34'; # asset version + % my $av = 'v35'; # asset version -- cgit v1.2.3
Name