summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-12-28 17:32:53 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-12-28 17:32:53 +0100
commita1b0bc8bfa848172321865c7c99f21e78b996472 (patch)
tree37a8fc84e65eea5fea44a50597d8dd989b5272ea
parent8f17811e420e7eaa4a5a4c6d86e3d7c665abd945 (diff)
landing page: always show latest stops
-rw-r--r--public/static/js/geolocation.js20
-rw-r--r--share/locales/de_DE.po3
-rw-r--r--share/locales/en_GB.po3
-rw-r--r--templates/landingpage.html.ep10
4 files changed, 16 insertions, 20 deletions
diff --git a/public/static/js/geolocation.js b/public/static/js/geolocation.js
index fdf757a..58f14a1 100644
--- a/public/static/js/geolocation.js
+++ b/public/static/js/geolocation.js
@@ -18,25 +18,7 @@ $(document).ready(function() {
$('div.geolocation').append(errnode);
- const recent = $('div.geolocation').data('recent');
- if (recent) {
- const stops = recent.split('|');
- const res = $(document.createElement('p'));
- $.each(stops, function(i, stop) {
- const parts = stop.split(';');
- const [ eva, name, dbris, efa, hafas, motis ] = parts;
-
- const node = $('<a class="tablerow" href="/s/' + eva + '?dbris=' + (dbris||0) + '&amp;efa=' + (efa||0) + '&amp;hafas=' + (hafas||0) + '&amp;motis=' + (motis||0) + '"><span>' + name + '</span></a>');
- node.click(function() {
- $('nav .preloader-wrapper').addClass('active');
- });
- res.append(node);
- });
- $('p.geolocationhint').text('Letzte Ziele:');
- getPlaceholder().replaceWith(res);
- } else {
- getPlaceholder().remove();
- }
+ getPlaceholder().remove();
};
const processResult = function(data) {
diff --git a/share/locales/de_DE.po b/share/locales/de_DE.po
index 96ad1a9..e6583d2 100644
--- a/share/locales/de_DE.po
+++ b/share/locales/de_DE.po
@@ -340,6 +340,9 @@ msgstr "!"
msgid "landingpage.not-checked-in"
msgstr "Du bist gerade nicht eingecheckt"
+msgid "landingpage.recent-stops"
+msgstr "Letzte Ziele"
+
msgid "landingpage.stop-geosearch"
msgstr "Stationen in der Umgebung suchen"
diff --git a/share/locales/en_GB.po b/share/locales/en_GB.po
index 9f53ac3..c32c738 100644
--- a/share/locales/en_GB.po
+++ b/share/locales/en_GB.po
@@ -339,6 +339,9 @@ msgstr "!"
msgid "landingpage.not-checked-in"
msgstr "You are not checked in at the moment"
+msgid "landingpage.recent-stops"
+msgstr "Latest destinations"
+
msgid "landingpage.stop-geosearch"
msgstr "Look for stops nearby"
diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep
index ba0433f..189fac4 100644
--- a/templates/landingpage.html.ep
+++ b/templates/landingpage.html.ep
@@ -57,7 +57,15 @@
<div class="card-content">
<span class="card-title"><%= L('landingpage.greeting-prefix') %> <%= $user->{name} %><%= L('landingpage.greeting-suffix') %></span>
<p><%= L('landingpage.not-checked-in') %>.</p>
- <div class="geolocation" data-recent="<%= join('|', map { $_->{external_id_or_eva} . ';' . $_->{name} . ';' . $_->{dbris} . ';' . $_->{efa} . ';' . $_->{hafas} . ';' . $_->{motis} } @{stash('recent_targets') // []} ) %>" data-backend="<%= $user->{backend_id} %>">
+ % if (@{stash('recent_targets') // []}) {
+ <p class="geolocationhint"><%= L('landingpage.recent-stops') %>:</p>
+ <p>
+ % for my $recent ( @{stash('recent_targets') // []} ) {
+ <a class="tablerow" href="/s/<%= $recent->{external_id_or_eva} %>?dbris=<%= $recent->{dbris} %>&amp;efa=<%= $recent->{efa} %>&amp;hafas=<%= $recent->{hafas} %>&amp;motis=<%= $recent->{motis} %>"><span><%= $recent->{name} %></span></a>
+ % }
+ </p>
+ % }
+ <div class="geolocation" data-backend="<%= $user->{backend_id} %>">
<a class="btn waves-effect waves-light btn-flat request"><%= L('landingpage.stop-geosearch') %></a>
</div>
%= hidden_field backend_dbris => $user->{backend_dbris}