From e07063c52c51569b5f252a202f5d71b5f70a73e7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 26 Apr 2019 19:53:01 +0200 Subject: Add manual journey entry Closes #3 --- templates/_history_trains.html.ep | 2 +- templates/add_journey.html.ep | 40 +++++++++++++++++++++++++++++++------- templates/cancelled.html.ep | 2 +- templates/history.html.ep | 34 +++++++++++++++++++++++++------- templates/history_by_month.html.ep | 4 ++-- templates/history_by_year.html.ep | 4 ++-- templates/journey.html.ep | 31 ++++++++++++++++++++--------- templates/landingpage.html.ep | 2 +- 8 files changed, 89 insertions(+), 30 deletions(-) (limited to 'templates') 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}; - <%= $travel->{sched_departure}->strftime('%d.%m.') %> + <%= $travel->{sched_departure}->strftime($date_format) %> <%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %> 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 @@

Zugfahrt eingeben

+% if (not get_oldest_journey_ts()) { +
+
+
+
+ Hinweis +

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.

+
+
+
+
+% } % if ($error) {
@@ -23,37 +37,49 @@ %= form_for '/journey/add' => (method => 'POST') => begin %= csrf_field
-
+
%= text_field 'train', id => 'train', class => 'validate', required => undef, pattern => '[0-9a-zA-Z]+ +[0-9a-zA-Z]* *[0-9]+'
+
+ +
%= text_field 'dep_station', id => 'dep_station', class => 'autocomplete validate', required => undef - +
%= 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]'
- %= 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]' - + %= 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]' +
%= text_field 'arr_station', id => 'arr_station', class => 'autocomplete validate', required => undef - +
%= 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]'
- %= 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]' - + %= 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]' + +
+
+
+
+ %= text_field 'comment' +
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 @@
-%= 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 @@
-

Nach Jahr

-% 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 { +
+
+ Noch keine Fahrten. +
+
+% }

Nach Monat

-%= include '_history_months', current => '', since => $since->clone, now => $now; +% if ($since) { + %= include '_history_months', current => '', since => $since->clone, now => $now; +% } +% else { +
+
+ Noch keine Fahrten. +
+
+% } % 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 @@ % } - - Meldungen - - % for my $message (@{$journey->{messages} // []}) { - % my ($ts, $msg) = @{$message}; - <%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %>
- % } - - + % if ($journey->{edited} == 0x3fff) { + + Kommentar + + % for my $message (@{$journey->{messages} // []}) { + <%= $message->[1] %>
+ % } + + + % } + % else { + + Meldungen + + % for my $message (@{$journey->{messages} // []}) { + % my ($ts, $msg) = @{$message}; + <%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %>
+ % } + + + % } Route @@ -172,6 +184,7 @@ %= form_for '/journey/edit' => (method => 'POST') => begin %= hidden_field 'journey_id' => param('journey_id') %= 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 @@

Letzte Fahrten

- %= include '_history_trains', journeys => [get_user_travels(limit => 5)]; + %= include '_history_trains', date_format => '%d.%m', journeys => [get_user_travels(limit => 5)]; % } % else {
-- cgit v1.2.3