Unverified Commit a1b0bc8b authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

landing page: always show latest stops

parent 8f17811e
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -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();
		}
	};

	const processResult = function(data) {
+3 −0
Original line number Diff line number Diff line
@@ -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"

+3 −0
Original line number Diff line number Diff line
@@ -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"

+9 −1
Original line number Diff line number Diff line
@@ -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}