summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-11-21 15:33:43 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-11-21 15:34:06 +0100
commitccfdd8007e136d5d98652d415dda8eb595a2ada9 (patch)
tree6b685625b796dfe3c251ab012a80239c6d3d1795 /templates
parente3fba3dcd493f609e107435867c4a67cb7ee420f (diff)
testing a more organized history navigation1.18.9
Diffstat (limited to 'templates')
-rw-r--r--templates/_history_months.html.ep21
-rw-r--r--templates/_history_months_for_year.html.ep16
-rw-r--r--templates/_history_years.html.ep22
-rw-r--r--templates/account.html.ep8
-rw-r--r--templates/history.html.ep27
-rw-r--r--templates/history_by_month.html.ep4
-rw-r--r--templates/history_by_year.html.ep4
-rw-r--r--templates/layouts/default.html.ep2
8 files changed, 55 insertions, 49 deletions
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 @@
<div class="row">
<div class="col s12">
<ul class="pagination">
- % 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';
- <li class="<%= $class %>"><a href="/history/<%= $link_to %>"><%= $text %></a></li>
+ % my ($prev, $current, $next) = journeys->get_nav_months(uid => current_user->{id}, year => $year, month => $month);
+ % if ($prev) {
+ <li class="waves-effect waves-light"><a href="/history/<%= $prev->[0] %>"><i class="material-icons">chevron_left</i></a></li>
% }
+ % else {
+ <li class="disabled"><a href="#!"><i class="material-icons">chevron_left</i></a></li>
+ % }
+ % if ($current) {
+ <li class="" style="min-width: 8em;"><a href="/history/<%= $current->[0] %>"><%= $current->[1] %></a></li>
+ % }
+ % if ($next) {
+ <li class="waves-effect waves-light"><a href="/history/<%= $next->[0] %>"><i class="material-icons">chevron_right</i></a></li>
+ % }
+ % else {
+ <li class="disabled"><a href="#!"><i class="material-icons">chevron_right</i></a></li>
+ % }
+ <li class=""><a href="/history/<%= $year %>"><%= $year %></a></li>
</ul>
</div>
</div>
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 @@
+<div class="row">
+ <div class="col s12">
+ <div class="collection">
+ % for my $month (journeys->get_months_for_year(uid => current_user->{id}, year => $year)) {
+ % if (defined $month->[2]) {
+ <a class="collection-item" href="/history/<%= $month->[0] %>"><%= $month->[1] %>
+ <span class="secondary-content"><%= sprintf('%.f', $month->[2]{km_route}) %> km</span>
+ </a>
+ % }
+ % else {
+ <div class="collection-item disabled"><%= $month->[1] %></div>
+ % }
+ % }
+ </div>
+ </div>
+</div>
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 @@
<div class="row">
<div class="col s12">
- <ul class="pagination">
- % 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';
- <li class="<%= $class %>"><a href="/history/<%= $link_to %>"><%= $text %></a></li>
- % }
- </ul>
+ % my @years = journeys->get_years(uid => current_user->{id});
+ % if (@years) {
+ <ul class="pagination">
+ % 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';
+ <li class="<%= $class %>"><a href="/history/<%= $link_to %>"><%= $text %></a></li>
+ % }
+ </ul>
+ % }
+ % else {
+ Keine Fahrten gefunden.
+ % }
</div>
</div>
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 @@
</div>
% }
-<h1>Account</h1>
% my $acc = current_user();
% my $hook = get_webhook();
% my $traewelling = traewelling->get($acc->{id});
% my $use_history = users->use_history(uid => $acc->{id});
<div class="row">
<div class="col s12">
+ <h2>Account</h2>
<table class="striped">
<tr>
<th scope="row">Name</th>
@@ -159,10 +159,10 @@
</div>
</div>
-<h2>API</h2>
% my $token = get_api_token();
<div class="row">
<div class="col s12">
+ <h2>API</h2>
<p>
Die folgenden API-Token erlauben den passwortlosen automatisierten Zugriff auf
API-Endpunkte. Bitte umsichtig behandeln – sobald ein Token gesetzt
@@ -273,10 +273,10 @@
</div>
-<h2>Export</h2>
<div class="row">
<div class="col s12">
+ <h2>Export</h2>
<ul>
<li><a href="/export.json">Rohdaten</a> (Kein API-Ersatz, das Format kann sich jederzeit ändern)</li>
</ul>
@@ -284,9 +284,9 @@
</div>
% if (not $acc->{deletion_requested}) {
- <h2>Löschen</h2>
<div class="row">
<div class="col s12">
+ <h2>Löschen</h2>
<p>
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 @@
-<h1>Fahrten</h1>
+<h2>Fahrten</h2>
-<div class="row">
- <div class="col s12">
- Hier finden sich alle bisherigen Zugfahrten und Statistiken für jedes
- Jahr und jeden Monat.
- </div>
-</div>
-
-<h2>Nach Jahr</h2>
%= include '_history_years', current => '';
-% if(0) {
- <div class="row">
- <div class="col s12">
- Noch keine Fahrten.
- </div>
- </div>
-% }
-
-<h2>Nach Monat</h2>
-%= include '_history_months', current => '';
-% if(0) {
- <div class="row">
- <div class="col s12">
- Noch keine Fahrten.
- </div>
- </div>
-% }
<h2>Auswertungen</h2>
<div class="row">
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}";
-
-<h1><%= stash('month_name') %> <%= stash('year') %></h1>
+%= 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;
-<h1>Jahresrückblick <%= $year %></h1>
-
% 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') // {}}) {
<meta property="og:<%= $key %>" content="<%= $value %>">
% }
- % my $av = 'v34'; # asset version
+ % my $av = 'v35'; # asset version
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-96x96.png" sizes="96x96">