blob: e87cc5e5ea581a294371a770645977b0de0f004e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<!DOCTYPE html>
<html>
<head>
<title><%= $title %></title>
<meta charset="utf-8">
% if ($self->stash('refresh_interval')) {
<meta http-equiv="refresh" content="<%= $self->stash('refresh_interval') %>"/>
% }
%= stylesheet '/infoscreen.css'
%= javascript '/jquery-2.1.1.min.js'
%= javascript '/collapse.js'
</head>
<body>
% if (my $error = stash 'error') {
<div class="error">Received an error from the backend service:</div>
<div>
<pre>
%= $error
</pre>
</div>
% }
<div class="displayclean">
<ul>
% for my $departure (@{$raw}) {
% my $linetype = q{};
% if ($departure->can('type')) {
% given ($departure->type) {
% when ($_ =~ m{enbahn$}) { $linetype = 'tram' }
% when ('S-Bahn') { $linetype = 'sbahn' }
% when ([qw[NE Niederflurbus SB Bus]]) { $linetype = 'bus' }
% when ('U-Bahn') { $linetype = 'ubahn' }
% }
% }
<li>
<span class="line <%= $linetype %>">
%= $departure->line
</span> <!-- line -->
<span class="moreinfo">
<div class="mheader">
<span class="train-line"><%= $departure->line %></span>
:
<span class="train-route">
% if ($departure->can('lineref') and $departure->lineref) {
%= $departure->lineref->route
% }
% elsif ($departure->can('route_pre') and $departure->can('route_post')) {
% if ($departure->route_pre) {
%= ($departure->route_pre)[0]->{stop}
% }
% if ($departure->route_post) {
% ($departure->route_post)[-1]->{stop}
% }
% }
</span> <!-- train-route -->
</div> <!-- mheader -->
% if ($departure->can('route_pre')) {
Fahrplan:
<ul>
% for my $stop ($departure->route_pre) {
<li><%= $stop->{dep_time} %> <%= $stop->{stop} %></li>
% }
</ul>
% }
% if ($departure->can('route_post')) {
<ul>
% for my $stop ($departure->route_post) {
<li><%= $stop->{arr_time} %> <%= $stop->{stop} %></li>
% }
</ul>
% }
</span> <!-- moreinfo -->
<span class="route">
% if ($departure->can('route_interesting') and $departure->route_interesting) {
%= join(' - ', map { $_->{stop_suf} } ($departure->route_interesting));
% }
% elsif ($departure->can('lineref') and $departure->lineref) {
%= $departure->lineref->route
% }
% elsif ($departure->can('route_timetable')) {
% my @first_deps = ($departure->route_timetable)[0..2];
% delete $first_deps[2] unless defined $first_deps[2];
% delete $first_deps[1] unless defined $first_deps[1];
% delete $first_deps[0] unless defined $first_deps[0];
%= join(' - ', map { $_->[1] } @first_deps );
% }
</span> <!-- route -->
<span class="dest">
%= $departure->destination
</span> <!-- dest -->
<span class="countdown">
% if ($departure->can('delay') and $departure->delay) {
<span class="delay"> (+<%= $departure->delay %>) </span>
% }
% if ($departure->can('is_cancelled') and $departure->is_cancelled) {
<span class="delay"> FÄLLT AUS </span>
% }
% else {
% if ($departure->countdown > 0) {
<%= $departure->countdown %> min
% }
% else {
sofort
% }
% }
</span> <!-- countdown -->
<span class="time">
%= $departure->time
</span>
</li>
% }
</ul>
</div>
</body>
</html>
|