From afe0b8eb2f3ff67a481f1ad1cb9420c07a47ae20 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Thu, 12 Jan 2017 15:05:05 +0100 Subject: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- templates/layout.html | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++ templates/layout.txt | 40 ++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 templates/layout.html create mode 100644 templates/layout.txt (limited to 'templates') diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..aead13f --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,124 @@ + + + +
+

Last updated: {{ data['ResponseData']['LatestUpdate'] }}

+ +
    + {%- for transport in ['Trains', 'Metros', 'Buses'] -%} + {%- if data['ResponseData'][transport] -%} +
  • {{ transport }}
  • + {%- endif -%} + {%- endfor -%} +
+ +

Stop deviations:

+ + {%- if data['ResponseData']['StopPointDeviations'] -%} + {%- for d in data['ResponseData']['StopPointDeviations'] -%} + {%- set stopinfo = d['StopInfo'] -%} + {%- set deviation = d['Deviation'] -%} +
+
{{ stopinfo['StopAreaName'] }} ({{ stopinfo['TransportMode'] }})
+
+

{{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }}

+
+

{{ deviation['Text'] }}

+
+
+
+
+ {%- endfor -%} + {%- endif -%} +
+ +{%- for transport in ['Trains', 'Metros', 'Buses'] -%} +{%- if data['ResponseData'][transport] -%} +
+

:: {{ transport }} ::

+ {%- 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'] == 'tunnelbanans blå linje' %} + {% set color='blue' %} + {% else %} + {% set color='black' %} + {% endif %} + {% endif %} + +
{% if departure['GroupOfLine'] %}{% endif %} + {{ departure['LineNumber'] }} :: {{ departure['Destination'] }} + {% if departure['SecondaryDestinationName'] %}({{ departure['SecondaryDestinationName'] }}){% endif %} + :: {{ departure['DisplayTime'] }} +
+ + {% if transport in ['Trains', 'Buses'] %} +
+

Stop: {{ departure['StopPointDesignation'] }}

+
+ {% endif %} + + {% if departure['GroupOfLine'] %} +
+

{{ departure['GroupOfLine'] }}

+
+ {% endif %} + + {%- if 'TimeTabledDateTime' in departure or 'ExpectedDateTime' in departure -%} +
+ {%- if departure['TimeTabledDateTime'] -%} +

Timetable: {{ departure['TimeTabledDateTime'] }}

+ {%- endif -%} + {%- if departure['ExpectedDateTime'] -%} +

Expected: {{ departure['ExpectedDateTime'] }}

+ {%- endif -%} +
+ {%- endif -%} + + {%- if departure['Deviations'] -%} +
+

Deviations:

+ + {%- for deviation in departure['Deviations'] -%} +
+

{{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }}

+
+

{{ deviation['Text'] }}

+
+
+ {%- endfor -%} +
+ {%- endif -%} +
+ + {%- endfor -%} +
+{%- endif -%} +{%- endfor -%} + + diff --git a/templates/layout.txt b/templates/layout.txt new file mode 100644 index 0000000..242fd94 --- /dev/null +++ b/templates/layout.txt @@ -0,0 +1,40 @@ +Last updated: {{ data['ResponseData']['LatestUpdate'] }} +{% if data['ResponseData']['StopPointDeviations'] %} +Stop deviations: +{% for d in data['ResponseData']['StopPointDeviations'] %} +{% set stopinfo = d['StopInfo'] %} +{% set deviation = d['Deviation'] %} + {{ stopinfo['StopAreaName'] }} ({{ stopinfo['TransportMode'] }}) + {{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }} + {{ deviation['Text'] }} + +{% endfor %} + +{% endif %} +{% for transport in ['Trains', 'Metros', 'Buses'] %} +{% if data['ResponseData'][transport] %} +:: {{ transport }} :: +{% for departure in data['ResponseData'][transport] %} +{% if departure['SecondaryDestinationName'] %} +{{ departure['LineNumber'] }} :: {{ departure['Destination'] }} ({{ departure['SecondaryDestinationName'] }}) :: {{ departure['DisplayTime'] }} +{% else %} +{{ departure['LineNumber'] }} :: {{ departure['Destination'] }} :: {{ departure['DisplayTime'] }} +{% endif %} +{% if transport == 'Buses' %} + Stop: {{ departure['StopPointDesignation'] }} +{% endif %} +{% if 'TimeTabledDateTime' in departure or 'ExpectedDateTime' in departure %} + Timetable: {{ departure['TimeTabledDateTime'] }} + Expected: {{ departure['ExpectedDateTime'] }} +{% endif %} +{% if departure['Deviations'] %} + Deviations: + {% for deviation in departure['Deviations'] %} + {{ deviation['ImportanceLevel'] }} :: {{ deviation['Consequence'] }} + {{ deviation['Text'] }} + {% endfor %} +{% endif %} + +{% endfor %} +{% endif %} +{% endfor %} -- cgit v1.2.3-54-g00ecf