diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-23 18:07:50 +0100 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-03-23 18:07:50 +0100 | 
| commit | a9b5a18943c3e2070703e745cd1131a02fd20365 (patch) | |
| tree | b65552c1a4a28e66811be19c5ec03e53fadc5600 /templates | |
| parent | 5ef9ef68529bb77d79aa4529c48c8de328232186 (diff) | |
Preliminary DBRIS support (not user-accessible yet)
working:
* checkin
* checkout
* realtime data
* polylines
* carriage formation (long-distance only)
to do:
* geolocation
* redirects after checkout / undo
* traewelling sync
* use dbris by default
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/_departures_dbris.html.ep | 54 | ||||
| -rw-r--r-- | templates/departures.html.ep | 18 | ||||
| -rw-r--r-- | templates/landingpage.html.ep | 1 | 
3 files changed, 67 insertions, 6 deletions
| diff --git a/templates/_departures_dbris.html.ep b/templates/_departures_dbris.html.ep new file mode 100644 index 0000000..14426e8 --- /dev/null +++ b/templates/_departures_dbris.html.ep @@ -0,0 +1,54 @@ +<ul class="collection departures"> +% my $orientation_bar_shown = param('train'); +% my $now_epoch = now->epoch; +% for my $result (@{$results}) { +	% my $row_class = ''; +	% my $link_class = 'action-checkin'; +	% if ($result->is_cancelled) { +		% $row_class = "cancelled"; +		% $link_class = 'action-cancelled-from'; +	% } +	% if (not $orientation_bar_shown and $result->dep->epoch < $now_epoch) { +		% $orientation_bar_shown = 1; +		<li class="collection-item" id="now"> +			<strong class="dep-time"> +				%= now->strftime('%H:%M') +			</strong> +			<strong>— Anfragezeitpunkt —</strong> +		</li> +	% } +	<li class="collection-item <%= $link_class %> <%= $row_class %>" +		data-dbris="<%= $dbris %>" +		data-station="<%= $result->stop_eva %>" +		data-train="<%= $result->id %>" +		data-ts="<%= ($result->sched_dep // $result->dep)->epoch %>" +	> +		<a class="dep-time" href="#"> +			%= $result->dep->strftime('%H:%M') +			% if ($result->delay) { +				(<%= sprintf('%+d', $result->delay) %>) +			% } +			% elsif (not defined $result->delay and not $result->is_cancelled) { +				<i class="material-icons" aria-label="Keine Echtzeitdaten vorhanden" style="font-size: 16px;">gps_off</i> +			% } +		</a> +		<span class="dep-line <%= $result->type // q{} %>"> +			%= $result->line +		</span> +		<span class="dep-dest"> +			% if ($result->is_cancelled) { +				Fahrt nach <%= $result->destination %> entfällt +			% } +			% else { +				%= $result->destination +				% for my $checkin (@{$checkin_by_train->{$result->id} // []}) { +					<span class="followee-checkin"> +						<i class="material-icons tiny" aria-label="Eine Person, der du folgst, ist hier eingecheckt">people</i> +						<%= $checkin->{followee_name} %> → <%= $checkin->{arr_name} // '???' %> +					</span> +				% } +			% } +		</span> +	</li> +% } +</ul> diff --git a/templates/departures.html.ep b/templates/departures.html.ep index a86a7b5..6e2a98a 100644 --- a/templates/departures.html.ep +++ b/templates/departures.html.ep @@ -9,7 +9,10 @@  	</div>  	<div class="col s4 center-align">  		% my $self_link = url_for('sstation', station => $station // param('station')); -		% if (param('hafas')) { +		% if (param('dbris')) { +			<a href="/account/select_backend?redirect_to=<%= $self_link %>" class="btn-small btn-flat"><i class="material-icons left" aria-hidden="true">directions</i><%= param('dbris') %></a> +		% } +		% elsif (param('hafas')) {  			<a href="/account/select_backend?redirect_to=<%= $self_link %>" class="btn-small btn-flat"><i class="material-icons left" aria-hidden="true">directions</i><%= param('hafas') %></a>  		% }  		% else { @@ -93,8 +96,8 @@  <div class="row">  	<div class="col s4 center-align"> -		% if ($hafas) { -			<a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({hafas => $hafas, timestamp => $datetime->clone->subtract(hours => 1)->epoch}) %>"><i class="material-icons left" aria-hidden="true">chevron_left</i><span class="hide-on-small-only">früher</span></a> +		% if ($dbris or $hafas) { +			<a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({dbris => $dbris, hafas => $hafas, timestamp => $datetime->clone->subtract(hours => 1)->epoch}) %>"><i class="material-icons left" aria-hidden="true">chevron_left</i><span class="hide-on-small-only">früher</span></a>  		% }  	</div>  	<div class="col s4 center-align"> @@ -103,8 +106,8 @@  		% }  	</div>  	<div class="col s4 center-align"> -		% if ($hafas) { -			<a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({hafas => $hafas, timestamp => $datetime->clone->add(hours => 1)->epoch}) %>"><span class="hide-on-small-only">später</span><i class="material-icons right" aria-hidden="true">chevron_right</i></a> +		% if ($dbris or $hafas) { +			<a class="btn-small" href="<%= url_for('sstation', station => param('station'))->query({dbris => $dbris, hafas => $hafas, timestamp => $datetime->clone->add(hours => 1)->epoch}) %>"><span class="hide-on-small-only">später</span><i class="material-icons right" aria-hidden="true">chevron_right</i></a>  		% }  	</div>  </div> @@ -139,7 +142,10 @@  			% }  		</p>  		% if (not $user_status->{checked_in} or ($can_check_out and $user_status->{arr_eva} and $user_status->{arrival_countdown} <= 0)) { -			% if ($hafas) { +			% if ($dbris) { +				%= include '_departures_dbris', results => $results, dbris => $dbris; +			% } +			% elsif ($hafas) {  				%= include '_departures_hafas', results => $results, hafas => $hafas;  			% }  			% else { diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index 8b6eb3f..856fdef 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -60,6 +60,7 @@  							<div class="geolocation" data-recent="<%= join('|', map { $_->{eva} . ';' . $_->{name} . ';' . $_->{hafas} } @{stash('recent_targets') // []} ) %>" data-backend="<%= $user->{backend_id} %>">  								<a class="btn waves-effect waves-light btn-flat request">Stationen in der Umgebung abfragen</a>  							</div> +							%= hidden_field backend_dbris => $user->{backend_dbris}  							<div class="input-field">  								%= text_field 'station', id => 'station', class => 'autocomplete contrast-color-text', autocomplete => 'off', required => undef  								<label for="station">Manuelle Eingabe</label> | 
