summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/display.html.ep23
-rw-r--r--templates/infoscreen.html.ep71
-rw-r--r--templates/main.html.ep169
3 files changed, 263 insertions, 0 deletions
diff --git a/templates/display.html.ep b/templates/display.html.ep
new file mode 100644
index 0000000..e65fdc9
--- /dev/null
+++ b/templates/display.html.ep
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title><%= $title %></title>
+ <meta charset="utf-8">
+ %= stylesheet '/display.css'
+ %= javascript '/jquery-2.1.1.min.js'
+</head>
+<body style="color: #<%= join(q{}, map { sprintf('%02x', $_) } @{$color} ) %>;
+ font-size: <%= $scale * 100 %>%;">
+
+<div class="outer">
+% for my $d (@{$departures}) {
+<div class="row">
+<div class="line"> <%= $d->[0] %> </div>
+<div class="dest"> <%= $d->[1] %> </div>
+<div class="time"> <%= $d->[2] %> </div>
+</div> <!-- row -->
+% }
+</div> <!-- outer -->
+
+</body>
+</html>
diff --git a/templates/infoscreen.html.ep b/templates/infoscreen.html.ep
new file mode 100644
index 0000000..47c435c
--- /dev/null
+++ b/templates/infoscreen.html.ep
@@ -0,0 +1,71 @@
+<!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'
+</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{};
+% 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>
+<span class="route">
+% if ($departure->lineref) {
+%= $departure->lineref->route
+% }
+</span>
+<span class="dest">
+%= $departure->destination
+</span>
+<span class="countdown">
+% if ($departure->delay) {
+<span class="delay"> (+<%= $departure->delay %>) </span>
+% }
+% if ($departure->is_cancelled) {
+<span class="delay"> FÄLLT AUS </span>
+% }
+% else {
+<%= $departure->countdown %> min
+% }
+</span>
+<span class="time">
+%= $departure->time
+</span>
+</li>
+% }
+</ul>
+</div>
+
+<div class="about">
+<a href="http://finalrewind.org/projects/db-fakedisplay/">db-fakedisplay</a>
+v<%= $version %>
+</div>
+
+</body>
+</html>
diff --git a/templates/main.html.ep b/templates/main.html.ep
new file mode 100644
index 0000000..8f42291
--- /dev/null
+++ b/templates/main.html.ep
@@ -0,0 +1,169 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title><%= $title %></title>
+ <meta charset="utf-8">
+ %= stylesheet '/main.css'
+ %= javascript '/jquery-2.1.1.min.js'
+ %= javascript '/image.js'
+</head>
+<body>
+
+% if ($city and $stop) {
+% if ($errstr) {
+<div class="error">Received an error from the backend service:</div>
+<div>
+<pre>
+%= $errstr
+</pre>
+</div>
+% }
+% elsif ($frontend eq 'png') {
+<img src="/<%= $city %>/<%= $stop %>.png?<%= $params %>" alt=""
+id="display" height="<%= $height * 4 %>" width="<%= $width * 4 %>"/>
+% }
+% elsif ($frontend eq 'html') {
+<iframe src="/<%= $city %>/<%= $stop %>.html?<%= $params %>" id="display"
+height="<%= $height * 5 %>" width="<%= $width * 5 %>"></iframe>
+% }
+% elsif ($frontend eq 'infoscreen') {
+<p>
+<a href="/<%= $city %>/<%= $stop %>.html?<%= $params %>&amp;template=infoscreen">Infoscreen for
+<%= $city %> <%= $stop %></a>
+</p>
+Preview:<br/>
+<iframe src="/<%= $city %>/<%= $stop %>.html?<%= $params %>&amp;template=infoscreen" id="display"
+height="<%= $height * 5 %>" width="<%= $width * 5 %>"></iframe>
+% }
+% elsif ($frontend eq 'json') {
+<p>
+<a href="/<%= $city %>/<%= $stop %>.json?<%= $params %>">JSON data for
+<%= $city %> <%= $stop %></a>
+</p>
+<p>
+Data is cached for 1 minute: JSON format:
+</p>
+<ul>
+<li>error: err string if an error occured, otherwise null</li>
+<li>preformatted: strings used by the PNG / HTML frontend</li>
+<li>raw:
+% if (param('backend') and param('backend') eq 'db') {
+serialized
+<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">
+Travel::Status::DE::DeutscheBahn</a>-objects, see the
+<a href="http://man.finalrewind.org/3/Travel-Status-DE-DeutscheBahn-Result/">::Result</a>
+documentation
+% }
+% else {
+serialized
+<a href="http://finalrewind.org/projects/Travel-Status-DE-VRR/">
+Travel::Status::DE::VRR</a>-objects, see the
+<a href="http://man.finalrewind.org/3/Travel-Status-DE-VRR-Result/">::Result</a>
+and
+<a href="http://man.finalrewind.org/3/Travel-Status-DE-VRR-Line/">::Line</a>
+documentation
+% }
+</li>
+<li>version: Program version (string, not numeric)</li>
+</ul>
+% }
+% } # ($city and $stop)
+% else {
+
+<p>
+VRR-Fakedisplay shows the next departures at a public transit stop, just like
+the Lumino LED displays used at some stops.
+</p>
+
+<p>
+It works best for the VRR (Verkehrsverbund Rhein-Ruhr), but also supports most
+other German transit networks.
+</p>
+
+% }
+
+<div class="input-field">
+
+% if (my $error = stash 'error') {
+<p>
+ Error: <%= $error %><br/>
+</p>
+% }
+
+%= form_for _redirect => begin
+<div>
+ <div class="field">
+ <div class="desc">City &rarr; Stop</div>
+ <div>
+ %= text_field 'city'
+ %= text_field 'stop'
+ %= submit_button 'Display'
+ </div>
+ </div>
+ <div class="break"></div>
+ <span class="optional">optional:</span>
+ <div class="field">
+ <div class="desc" title="number of lines">
+ display height [1..10]</div>
+ <div>
+ %= text_field 'no_lines'
+ </div>
+ </div>
+ <div class="field">
+ <div class="desc">min. offset [minutes]</div>
+ <div>
+ %= text_field 'offset'
+ </div>
+ </div>
+ <div class="field">
+ <div class="desc" title="comma-separated list, example: NE,U,10">
+ match line prefixes¹</div>
+ <div>
+ %= text_field 'line'
+ </div>
+ </div>
+ <div class="field">
+ <div class="desc" title="comma-separated list. Buggy.">match platform¹</div>
+ <div>
+ %= text_field 'platform'
+ </div>
+ </div>
+ <div class="field">
+ <div class="desc">backend</div>
+ <div>
+ %= select_field backend => [['EFA (VRR)' => 'vrr'], ['HAFAS (DB)' => 'db']]
+ </div>
+ </div>
+ <div class="field">
+ <div class="desc">frontend</div>
+ <div>
+ %= select_field frontend => [['Image (PNG)' => 'png'], ['HTML' => 'html'], ['Infoscreen' => 'infoscreen'], ['JSON' => 'json']]
+ </div>
+ </div>
+</div>
+% end
+
+<p>
+<b>¹</b> separate values with commas, e.g. NE,U,10
+</p>
+</div> <!-- input-field -->
+
+<div class="notes">
+<span class="notes">notes:</span>
+<ul>
+<li>The EFA backend does not support Umlauts</li>
+<li>For D&uuml;sseldorf, the DB backend usually gives better results</li>
+<li>If you write the city correctly (like "Essen", not "essen"), vrr-fake can
+shorten destination names</li>
+<li><a href="/Essen/Martinstr?no_lines=8">Example</a>
+</li>
+</ul>
+</div> <!-- notes -->
+
+<div class="about">
+<a href="http://finalrewind.org/projects/vrr-fakedisplay/">vrr-fakedisplay</a>
+v<%= $version %>
+</div>
+
+</body>
+</html>