summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-04-27 14:09:09 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-04-27 14:09:09 +0200
commitd84bfa2cfae3167e3d7c09060cc3d066850b49b7 (patch)
tree3d627575befc2373898e3f3ba0f26dec165afc2e
parentb549bb47e473fc37916622463d2dd8b0b8df93ed (diff)
wagenreihung: show train type and direction next to wagons
-rw-r--r--templates/_wagon.html.ep11
-rw-r--r--templates/wagenreihung.html.ep40
2 files changed, 26 insertions, 25 deletions
diff --git a/templates/_wagon.html.ep b/templates/_wagon.html.ep
index 2f5a0df..66cf6e8 100644
--- a/templates/_wagon.html.ep
+++ b/templates/_wagon.html.ep
@@ -44,9 +44,9 @@
% }
% }
<div class="direction">
-% if (not defined $direction) {
+% if (not defined $wr->direction) {
% }
-% elsif ($direction == 100) {
+% elsif ($wr->direction == 100) {
<i class="material-icons">arrow_downward</i>
% }
% else {
@@ -57,7 +57,7 @@
<div class="details" style="
top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;">
% if ($exit_dir ne 'right') {
-% if (my $img = wagon_image($wagon->train_subtype // $type // '?', $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
<a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
% }
% else {
@@ -77,7 +77,7 @@
<span class="uicexchange"><%= substr($uic_id, 0, 2) %></span><span class="uiccountry"><%= substr($uic_id, 2, 2) %></span><span class="uic56"><%= substr($uic_id, 4, 2) %></span><span class="uic78"><%= substr($uic_id, 6, 2) %></span><span class="uicno"><%= substr($uic_id, 8, 3) %></span><span class="uiccheck"><%= substr($uic_id, 11) %></span>
% }
% if ($exit_dir eq 'right') {
-% if (my $img = wagon_image($wagon->train_subtype // $type // '?', $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
<a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
% }
% else {
@@ -86,4 +86,7 @@
</span>
% }
% }
+% if ($multi and defined $wagon->group_index and (not defined $prev_gi or $wagon->group_index != $prev_gi)) {
+ <br/><span class="grouptype"><%= ($wr->train_descriptions)[$wagon->group_index]{short} %> → <%= $wr->{data}{istformation}{allFahrzeuggruppe}[$wagon->group_index]{zielbetriebsstellename} %></span>
+% }
</div>
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep
index a68590b..820a484 100644
--- a/templates/wagenreihung.html.ep
+++ b/templates/wagenreihung.html.ep
@@ -17,27 +17,8 @@
% }
<div class="container">
<div style="text-align: center;">
-%= join( ' / ', map { $_->{name} } $wr->origins )
- →
-%= join( ' / ', map { $_->{name} } $wr->destinations )
+ <%= $wr->station->{name} %> Gleis <%= $wr->platform %><br/>
</div>
- % if ($has_multi_dest) {
- <div style="text-align: center;">
- % for my $destination ($wr->destinations) {
- Nach <%= $destination->{name} %> in Abschnitt <%= join(q{}, sort @{$destination->{sections} // []}) %><br/>
- % }
- </div>
- % }
- <%= $wr->station->{name} %> Gleis <%= $wr->platform %><br/>
- % for my $desc ($wr->train_descriptions) {
- % if ($desc->{text}) {
- %= $desc->{text}
- % if ($has_multi_desc and length(join(q{}, sort @{$desc->{sections}}))) {
- in Abschnitt <%= join(q{}, sort @{$desc->{sections}}) %>
- % }
- <br/>
- % }
- % }
</div>
<div class="container">
<div class="wagonorder exit-<%= stash('exit_dir') // 'unknown'%>">
@@ -49,10 +30,27 @@
</div>
% }
% }
+% my $gi;
% for my $wagon ($wr->wagons) {
-%= include '_wagon', direction => $wr->direction, wagon => $wagon, type => $wr->train_type, wref => $wref, exit_dir => stash('exit_dir');
+%= include '_wagon', wr => $wr, wagon => $wagon, prev_gi => $gi, multi => $has_multi_desc + $has_multi_dest, wref => $wref, exit_dir => stash('exit_dir');
+% $gi = $wagon->group_index;
% }
</div>
+ <div style="text-align: center;">
+%= join( ' / ', map { $_->{name} } $wr->origins )
+ →
+%= join( ' / ', map { $_->{name} } $wr->destinations )
+ </div>
+ % for my $desc ($wr->train_descriptions) {
+ % if ($desc->{text}) {
+ <div style="text-align: center;">
+ %= $desc->{text}
+ % if ($has_multi_desc and length(join(q{}, sort @{$desc->{sections}}))) {
+ in Abschnitt <%= join(q{}, sort @{$desc->{sections}}) %>
+ % }
+ </div>
+ % }
+ % }
<!-- <div>
Legende: ♿ Behindertengerechte Ausstattung / 🍴 Bistro/Restaurant / 🚪 Abteile vorhanden
</div>