From e42a988a2738e4a079e9277c3bb5a3cbcbfa5395 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 28 Dec 2020 14:43:04 +0100 Subject: improve display of double decker wagons --- lib/DBInfoscreen/Controller/Wagenreihung.pm | 19 ++++++++++++------ share/dbdb_wagen.json | 2 +- templates/wagen.html.ep | 30 +++++++++++++++-------------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index 9f56ce1..3cc8f39 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -236,8 +236,15 @@ sub wagen { $wref->{wn} = $wagon_no; $wref->{ws} = $section; - my $wagon_file - = "https://lib.finalrewind.org/dbdb/db_wagen/${wagon_id}.png"; + my @wagon_files + = ("https://lib.finalrewind.org/dbdb/db_wagen/${wagon_id}.png"); + + if ( $self->app->dbdb_wagon->{"${wagon_id}_u"} ) { + @wagon_files = ( + "https://lib.finalrewind.org/dbdb/db_wagen/${wagon_id}_u.png", + "https://lib.finalrewind.org/dbdb/db_wagen/${wagon_id}_l.png" + ); + } my $title = "Wagen $wagon_id"; @@ -271,10 +278,10 @@ sub wagen { $self->render( 'wagen', - title => $title, - wagon_file => $wagon_file, - wref => $wref, - hide_opts => 1, + title => $title, + wagon_files => [@wagon_files], + wref => $wref, + hide_opts => 1, ); } diff --git a/share/dbdb_wagen.json b/share/dbdb_wagen.json index a2063c8..3674828 100644 --- a/share/dbdb_wagen.json +++ b/share/dbdb_wagen.json @@ -1 +1 @@ -{"08120":"true","1101":"true","1104":"true","1105":"true","1106":"true","14120":"true","18120":"true","24120":"true","24123":"true","24125":"true","24128":"true","31_4030":"true","31_4031":"true","31_4032":"true","31_4033":"true","31_4035":"true","31_4036":"true","31_4037":"true","31_4038":"true","32_4030":"true","32_4031":"true","32_4032":"true","32_4033":"true","32_4035":"true","32_4036":"true","32_4037":"true","32_4038":"true","3_4060":"true","3_4061":"true","3_4062":"true","3_4063":"true","3_4065":"true","3_4066":"true","3_4067":"true","3_4068":"true","3r_4030":"true","3r_4031":"true","3r_4032":"true","3r_4033":"true","3r_4035":"true","3r_4036":"true","3r_4037":"true","3r_4038":"true","3r_4060":"true","3r_4061":"true","3r_4062":"true","3r_4063":"true","3r_4065":"true","3r_4066":"true","3r_4067":"true","3r_4068":"true","4070":"true","4071":"true","4072":"true","4073":"true","4075":"true","4076":"true","4077":"true","4078":"true","4150":"true","4151":"true","4155":"true","4156":"true","4157":"true","48120":"true","58120":"true","64120":"true","8010":"true","8014":"true","8018":"true","8020":"true","8023":"true","8026":"true","8027":"true","8028":"true","8029":"true","8031":"true","8040":"true","8050":"true","8053":"true","8060":"true","8063":"true","8066":"true","8070":"true","8080":"true","88120":"true","98120":"true","ARkimbz":"true","ARkimmbz":"true","Apmmz":"true","Avmmz":"true","Avmz":"true","Bimmdzf":"true","Bpmbz":"true","Bpmmbdz":"true","Bpmmbdzf":"true","Bpmmbz":"true","Bpmmdz":"true","Bpmmz":"true","Bvmmsz":"true","Bvmmz":"true","Bvmsz":"true","COPYING":"true","DApza":"true","DBpbzfa":"true","DBpza":"true","t1_4110":"true","t1_4111":"true","t1_4112":"true","t1_4115":"true","t1_4116":"true","t1_4117":"true","t1_4118":"true","t2_4110":"true","t2_4111":"true","t2_4112":"true","t2_4115":"true","t2_4116":"true","t2_4117":"true","t2_4118":"true","wagons":"true"} +{"08120":true,"1101":true,"1101_l":true,"1101_u":true,"1104":true,"1104_l":true,"1104_u":true,"1105":true,"1105_l":true,"1105_u":true,"1106":true,"1106_l":true,"1106_u":true,"14120":true,"18120":true,"24120":true,"24123":true,"24125":true,"24128":true,"31_4030":true,"31_4031":true,"31_4032":true,"31_4033":true,"31_4035":true,"31_4036":true,"31_4037":true,"31_4038":true,"32_4030":true,"32_4031":true,"32_4032":true,"32_4033":true,"32_4035":true,"32_4036":true,"32_4037":true,"32_4038":true,"3_4060":true,"3_4061":true,"3_4062":true,"3_4063":true,"3_4065":true,"3_4066":true,"3_4067":true,"3_4068":true,"3r_4030":true,"3r_4031":true,"3r_4032":true,"3r_4033":true,"3r_4035":true,"3r_4036":true,"3r_4037":true,"3r_4038":true,"3r_4060":true,"3r_4061":true,"3r_4062":true,"3r_4063":true,"3r_4065":true,"3r_4066":true,"3r_4067":true,"3r_4068":true,"4070":true,"4071":true,"4072":true,"4073":true,"4075":true,"4076":true,"4077":true,"4078":true,"4150":true,"4151":true,"4155":true,"4156":true,"4157":true,"48120":true,"58120":true,"64120":true,"8010":true,"8014":true,"8018":true,"8020":true,"8023":true,"8026":true,"8027":true,"8028":true,"8029":true,"8031":true,"8040":true,"8050":true,"8053":true,"8060":true,"8063":true,"8066":true,"8070":true,"8080":true,"88120":true,"98120":true,"ARkimbz":true,"ARkimmbz":true,"Apmmz":true,"Avmmz":true,"Avmz":true,"Bimmdzf":true,"Bpmbz":true,"Bpmmbdz":true,"Bpmmbdzf":true,"Bpmmbz":true,"Bpmmdz":true,"Bpmmz":true,"Bvmmsz":true,"Bvmmz":true,"Bvmsz":true,"DApza":true,"DApza_l":true,"DApza_u":true,"DBpbzfa":true,"DBpbzfa_l":true,"DBpbzfa_u":true,"DBpza":true,"DBpza_l":true,"DBpza_u":true,"t1_4110":true,"t1_4111":true,"t1_4112":true,"t1_4115":true,"t1_4116":true,"t1_4117":true,"t1_4118":true,"t2_4110":true,"t2_4111":true,"t2_4112":true,"t2_4115":true,"t2_4116":true,"t2_4117":true,"t2_4118":true} diff --git a/templates/wagen.html.ep b/templates/wagen.html.ep index 9cf4793..b08b212 100644 --- a/templates/wagen.html.ep +++ b/templates/wagen.html.ep @@ -4,23 +4,25 @@ <%= $wref->{s} %>: Gleis <%= $wref->{p} %> <%= $wref->{ws} %>

% } - % if (defined $wref->{d}) { -
- % if ($wref->{d} == 0) { - arrow_back - % } - % else { - arrow_forward - % } -
- % } % if ($wref->{e} eq 'u') {
arrow_upward
arrow_upward
% } -
- -
+ % for my $wagon_file (@{$wagon_files // [] }) { + % if (defined $wref->{d}) { +
+ % if ($wref->{d} == 0) { + arrow_back + % } + % else { + arrow_forward + % } +
+ % } +
+ +
+ % } % if ($wref->{e} eq 'd') {
arrow_downward
arrow_downward
@@ -35,7 +37,7 @@ % } % } - -- cgit v1.2.3