summaryrefslogtreecommitdiff
path: root/templates/infoscreen.html.ep
blob: 4a4f309b4a0927d44074b690681823e096de2add (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!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]->name
%     }
%     if ($departure->route_post) {
%       ($departure->route_post)[-1]->name
%     }
%   }
    </span> <!-- train-route -->
    </div> <!-- mheader -->
%   if ($departure->can('route_pre')) {
      Fahrplan:
      <table class="scheduled">
%     for my $stop ($departure->route_pre) {
        <tr class="routepre"><td class="time">
%       if (not defined $stop->arr_time) {
          <%= $stop->dep_time %>
%       }
%       elsif (not defined $stop->dep_time) {
          <%= $stop->arr_time %>
%       }
%       elsif ( $stop->arr_time eq $stop->dep_time ) {
          <%= $stop->dep_time %>
%       }
%       else {
          <%= $stop->arr_time %> → <%= $stop->dep_time %>
%       }
        </td>
        <td class="stop"><%= $stop->name %></td></tr>
%     }
      <tr class="routenow"><td class="time">
%     if ($departure->can('sched_time')) {
        <%= $departure->sched_time %>
%     }
%     else {
        <%= $departure->time %>
%     }
      </td>
      <td class="stop"><%= $id_name %> <%= $id_stop %></td></tr>
%     for my $stop ($departure->route_post) {
        <tr class="routepost"><td class="time">
%       if (not defined $stop->arr_time) {
          <%= $stop->dep_time %>
%       }
%       elsif (not defined $stop->dep_time) {
          <%= $stop->arr_time %>
%       }
%       elsif ( $stop->arr_time eq $stop->dep_time ) {
          <%= $stop->dep_time %>
%       }
%       else {
          <%= $stop->arr_time %> → <%= $stop->dep_time %>
%       }
        </td>
        <td class="stop"><%= $stop->name %></td></tr>
%     }
      </table>
%   }
    </span> <!-- moreinfo -->
    <span class="route">
%   if ($departure->can('route_interesting') and $departure->route_interesting) {
%=    join(' - ', map { ref($_) ? $_->name_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->can('countdown')) {
%       if ($departure->countdown > 0) {
          <%= $departure->countdown %> min
%       }
%       else {
          sofort
%       }
%     }
%   }
    </span> <!-- countdown -->
    <span class="time">
%=  $departure->time
    </span>
    </li>
% }
</ul>
</div>

</body>
</html>