summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-26 19:53:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-26 19:53:01 +0200
commite07063c52c51569b5f252a202f5d71b5f70a73e7 (patch)
tree301f64f3fe95038a2551a81c927ff0206df93243 /templates
parent2cae5a51d2f2a8002864860f452fa9474dc2ecb3 (diff)
Add manual journey entry
Closes #3
Diffstat (limited to 'templates')
-rw-r--r--templates/_history_trains.html.ep2
-rw-r--r--templates/add_journey.html.ep40
-rw-r--r--templates/cancelled.html.ep2
-rw-r--r--templates/history.html.ep34
-rw-r--r--templates/history_by_month.html.ep4
-rw-r--r--templates/history_by_year.html.ep4
-rw-r--r--templates/journey.html.ep31
-rw-r--r--templates/landingpage.html.ep2
8 files changed, 89 insertions, 30 deletions
diff --git a/templates/_history_trains.html.ep b/templates/_history_trains.html.ep
index 2328285..d422165 100644
--- a/templates/_history_trains.html.ep
+++ b/templates/_history_trains.html.ep
@@ -13,7 +13,7 @@
% for my $travel (@{$journeys}) {
% my $detail_link = '/journey/' . $travel->{id};
<tr>
- <td><%= $travel->{sched_departure}->strftime('%d.%m.') %></td>
+ <td><%= $travel->{sched_departure}->strftime($date_format) %></td>
<td><a href="<%= $detail_link %>"><%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %></a></td>
<td>
<a href="<%= $detail_link %>" class="unmarked">
diff --git a/templates/add_journey.html.ep b/templates/add_journey.html.ep
index e07f78f..10e74eb 100644
--- a/templates/add_journey.html.ep
+++ b/templates/add_journey.html.ep
@@ -1,4 +1,18 @@
<h1>Zugfahrt eingeben</h1>
+% if (not get_oldest_journey_ts()) {
+ <div class="row">
+ <div class="col s12">
+ <div class="card yellow lighten-4">
+ <div class="card-content">
+ <span class="card-title">Hinweis</span>
+ <p>travelynx ist darauf ausgelegt, über die Hauptseite in
+ Echtzeit in Züge ein- und auszuchecken. Die manuelle
+ Eingabe von Zugfahrten ist nur als Notlösung vorgesehen.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+% }
% if ($error) {
<div class="row">
<div class="col s12">
@@ -23,37 +37,49 @@
%= form_for '/journey/add' => (method => 'POST') => begin
%= csrf_field
<div class="row">
- <div class="input-field col s12">
+ <div class="input-field col s12 m6 l6">
%= text_field 'train', id => 'train', class => 'validate', required => undef, pattern => '[0-9a-zA-Z]+ +[0-9a-zA-Z]* *[0-9]+'
<label for="train">Zug (Typ Linie Nummer)</label>
</div>
+ <div class="input-field col s12 m6 l6">
+ <label>
+ %= check_box cancelled => 1
+ <span>Fahrt ist ausgefallen</span>
+ </label>
+ </div>
</div>
<div class="row">
<div class="input-field col s12">
%= text_field 'dep_station', id => 'dep_station', class => 'autocomplete validate', required => undef
- <label for="dep_station">Startbahnhof (Name oder DS100)</label>
+ <label for="dep_station">Start (Name oder DS100)</label>
</div>
<div class="input-field col s12">
%= text_field 'sched_departure', id => 'sched_departure', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
<label for="sched_departure">Geplante Abfahrt</label>
</div>
<div class="input-field col s12">
- %= text_field 'rt_departure', id => 'rt_departure', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
- <label for="rt_departure">Tatsächliche Abfahrt (optional)</label>
+ %= text_field 'rt_departure', id => 'rt_departure', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
+ <label for="rt_departure">Tatsächliche Abfahrt</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
%= text_field 'arr_station', id => 'arr_station', class => 'autocomplete validate', required => undef
- <label for="arr_station">Zielbahnhof (Name oder DS100)</label>
+ <label for="arr_station">Ziel (Name oder DS100)</label>
</div>
<div class="input-field col s12">
%= text_field 'sched_arrival', id => 'sched_arrival', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
<label for="sched_arrival">Geplante Ankunft</label>
</div>
<div class="input-field col s12">
- %= text_field 'rt_arrival', id => 'rt_arrival', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
- <label for="rt_arrival">Tatsächliche Ankunft (optional)</label>
+ %= text_field 'rt_arrival', id => 'rt_arrival', class => 'validate', required => undef, pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9] +[0-9][0-9]:[0-9][0-9]'
+ <label for="rt_arrival">Tatsächliche Ankunft</label>
+ </div>
+ </div>
+ <div class="row">
+ <div class="input-field col s12">
+ %= text_field 'comment'
+ <label for="comment">Kommentar</label>
</div>
</div>
<div class="row">
diff --git a/templates/cancelled.html.ep b/templates/cancelled.html.ep
index 88380ce..4fab434 100644
--- a/templates/cancelled.html.ep
+++ b/templates/cancelled.html.ep
@@ -17,4 +17,4 @@
</div>
</div>
-%= include '_history_trains', journeys => stash('journeys');
+%= include '_history_trains', date_format => '%d.%m.%Y', journeys => stash('journeys');
diff --git a/templates/history.html.ep b/templates/history.html.ep
index 05f4777..246d6af 100644
--- a/templates/history.html.ep
+++ b/templates/history.html.ep
@@ -8,24 +8,44 @@
</div>
<div class="row">
- <div class="col s12 m12 l4 center-align">
+ <div class="col s12 m12 l3 center-align">
<a href="/cancelled" class="waves-effect waves-light btn"><i class="material-icons left">cancel</i> Zugausfälle</a>
</div>
- <div class="col s12 m12 l4">
- &nbsp;
- </div>
+ <div class="col s12 m12 l1">&nbsp;</div>
<div class="col s12 m12 l4 center-align">
+ <a href="/journey/add" class="waves-effect waves-light btn"><i class="material-icons left">add</i> Neue Fahrt</a>
+ </div>
+ <div class="col s12 m12 l1">&nbsp;</div>
+ <div class="col s12 m12 l3 center-align">
<a href="/history.json" class="waves-effect waves-light btn"><i class="material-icons left">cloud</i> JSON-Export</a>
</div>
</div>
<h2>Nach Jahr</h2>
-% my $since = get_user_data()->{registered_at};
+% my $since = get_oldest_journey_ts();
% my $now = DateTime->now(time_zone => 'Europe/Berlin');
-%= include '_history_years', current => '', since => $since->clone, now => $now;
+% if ($since) {
+ %= include '_history_years', current => '', since => $since->clone, now => $now;
+% }
+% else {
+ <div class="row">
+ <div class="col s12">
+ Noch keine Fahrten.
+ </div>
+ </div>
+% }
<h2>Nach Monat</h2>
-%= include '_history_months', current => '', since => $since->clone, now => $now;
+% if ($since) {
+ %= include '_history_months', current => '', since => $since->clone, now => $now;
+% }
+% else {
+ <div class="row">
+ <div class="col s12">
+ Noch keine Fahrten.
+ </div>
+ </div>
+% }
% if (stash('statistics')) {
%= include '_history_stats', stats => stash('statistics');
diff --git a/templates/history_by_month.html.ep b/templates/history_by_month.html.ep
index 3794858..64d42c6 100644
--- a/templates/history_by_month.html.ep
+++ b/templates/history_by_month.html.ep
@@ -1,4 +1,4 @@
-% my $since = get_user_data()->{registered_at};
+% my $since = get_oldest_journey_ts();
% my $now = DateTime->now(time_zone => 'Europe/Berlin');
%= include '_history_months', current => "${year}/${month}", since => $since, now => $now;
@@ -9,5 +9,5 @@
% }
% if (stash('journeys')) {
- %= include '_history_trains', journeys => stash('journeys');
+ %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys');
% }
diff --git a/templates/history_by_year.html.ep b/templates/history_by_year.html.ep
index 97c223f..f73d7ec 100644
--- a/templates/history_by_year.html.ep
+++ b/templates/history_by_year.html.ep
@@ -1,4 +1,4 @@
-% my $since = get_user_data()->{registered_at};
+% my $since = get_oldest_journey_ts();
% my $now = DateTime->now(time_zone => 'Europe/Berlin');
%= include '_history_years', current => $year, since => $since, now => $now;
@@ -9,5 +9,5 @@
% }
% if (stash('journeys')) {
- %= include '_history_trains', journeys => stash('journeys');
+ %= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys');
% }
diff --git a/templates/journey.html.ep b/templates/journey.html.ep
index 4af9694..4d0f3fd 100644
--- a/templates/journey.html.ep
+++ b/templates/journey.html.ep
@@ -121,15 +121,27 @@
% }
</td>
</tr>
- <tr>
- <th scope="row">Meldungen</th>
- <td>
- % for my $message (@{$journey->{messages} // []}) {
- % my ($ts, $msg) = @{$message};
- <%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %><br/>
- % }
- </td>
- </tr>
+ % if ($journey->{edited} == 0x3fff) {
+ <tr>
+ <th scope="row">Kommentar</th>
+ <td>
+ % for my $message (@{$journey->{messages} // []}) {
+ <%= $message->[1] %><br/>
+ % }
+ </td>
+ </tr>
+ % }
+ % else {
+ <tr>
+ <th scope="row">Meldungen</th>
+ <td>
+ % for my $message (@{$journey->{messages} // []}) {
+ % my ($ts, $msg) = @{$message};
+ <%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %><br/>
+ % }
+ </td>
+ </tr>
+ % }
<tr>
<th scope="row">Route</th>
<td>
@@ -172,6 +184,7 @@
%= form_for '/journey/edit' => (method => 'POST') => begin
%= hidden_field 'journey_id' => param('journey_id')
<button class="btn waves-effect waves-light" type="submit" name="action" value="edit">
+ <i class="material-icons left">edit</i>
Bearbeiten
</button>
%= end
diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep
index e694229..c6551ec 100644
--- a/templates/landingpage.html.ep
+++ b/templates/landingpage.html.ep
@@ -73,7 +73,7 @@
</div>
</div>
<h1>Letzte Fahrten</h1>
- %= include '_history_trains', journeys => [get_user_travels(limit => 5)];
+ %= include '_history_trains', date_format => '%d.%m', journeys => [get_user_travels(limit => 5)];
% }
% else {
<div class="row">