summaryrefslogtreecommitdiffstats
path: root/templates/layout.html
blob: 4715a950bf4a4d96def2284a20d6898dedc52635 (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
<style>
h4 {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}
h5 {
    margin-top: 0em;
    margin-bottom: 0em;
}
div {
    margin: 0;
    padding: 0;
    padding-left: 2rem;
}
div.root {
    padding-left: 0em;
}
p {
    margin: 0;
    padding: 0;
}
</style>


<div class="root">
	<h1>{{ stop_name }}</h1>
	<p>Last updated: {{ data['ResponseData']['LatestUpdate'] }}</p>

	<ul>
	{%- for transport in ['Trains', 'Metros', 'Buses'] -%}
	{%- if data['ResponseData'][transport] -%}
		<li><a href="#{{ transport }}">{{ transport }}</a></li>
	{%- endif -%}
	{%- endfor -%}
	</ul>

	<h4>Stop deviations:</h4>

	{%- if data['ResponseData']['StopPointDeviations'] -%}
		{%- for d in data['ResponseData']['StopPointDeviations'] -%}
		{%- set stopinfo = d['StopInfo'] -%}
		{%- set deviation = d['Deviation'] -%}
		<div>
			<h5>{{ stopinfo['StopAreaName'] }} ({{ stopinfo['TransportMode'] }})</h5>
			<div>
				<p>{{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }}</p>
				<div>
					<p>{{ deviation['Text'] }}</p>
				</div>
			</div>
		</div>
		</br>
		{%- endfor -%}
	{%- endif -%}
</div>

{%- for transport in ['Trains', 'Metros', 'Buses'] -%}
{%- if data['ResponseData'][transport] -%}
<div class="root">
	<h4 id="{{ transport }}">:: {{ transport }} ::</h4>
	{%- for departure in data['ResponseData'][transport] -%}

	{% if departure['GroupOfLine'] %}
		{% if departure['GroupOfLine'] == 'tunnelbanans gröna linje' %}
			{% set color='green' %}
		{% elif departure['GroupOfLine'] == 'Tunnelbanans röda linje' %}
			{% set color='red' %}
		{% elif departure['GroupOfLine'] in ['blåbuss', 'tunnelbanans blå linje'] %}
			{% set color='blue' %}
		{% else %}
			{% set color='black' %}
		{% endif %}
	{% endif %}

	<h5>{% if departure['GroupOfLine'] %}<span style="color: {{color}}"></span>{% endif %}
		{{ departure['LineNumber'] }} :: {{ departure['Destination'] }}
		{% if departure['SecondaryDestinationName'] %}({{ departure['SecondaryDestinationName'] }}){% endif %}
	   :: {{ departure['DisplayTime'] }}
	</h5>

	{% if transport in ['Trains', 'Buses'] %}
	<div>
		<p>Stop: {{ departure['StopPointDesignation'] }}</p>
	</div>
	{% endif %}

	{% if departure['GroupOfLine'] %}
	<div>
		<p>{{ departure['GroupOfLine'] }}</p>
	</div>
	{% endif %}

	{%- if 'TimeTabledDateTime' in departure or 'ExpectedDateTime' in departure -%}
	<div>
		{%- if departure['TimeTabledDateTime'] -%}
		<p>Timetable: {{ departure['TimeTabledDateTime'] }}</p>
		{%- endif -%}
		{%- if departure['ExpectedDateTime'] -%}
		<p>Expected: {{ departure['ExpectedDateTime'] }}</p>
		{%- endif -%}
	</div>
	{%- endif -%}

	{%- if departure['Deviations'] -%}
		<div>
			<p>Deviations:</p>

			{%- for deviation in departure['Deviations'] -%}
			<div>
				<p>{{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }}</p>
				<div>
					<p>{{ deviation['Text'] }}</p>
				</div>
			</div>
			{%- endfor -%}
		</div>
	{%- endif -%}
	</br>

	{%- endfor -%}
</div>
{%- endif -%}
{%- endfor -%}

<!-- vim: set ft=html: -->