From efa73cbfc4f2a84b5bc9d5e7ba7c491fe2751ef5 Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Wed, 20 Dec 2017 13:50:03 +0100 Subject: [PATCH] Finish flightplan --- cms/generate.py | 22 +++++++++++++------- cms/static/stylesheet.css | 9 ++++++++ cms/templates/base.html | 39 +++++++++++++++++++++++++++++++++++ cms/templates/index.html | 41 +++++-------------------------------- cms/templates/schedule.html | 22 ++++++++++++++++++++ 5 files changed, 90 insertions(+), 43 deletions(-) create mode 100644 cms/templates/base.html create mode 100644 cms/templates/schedule.html diff --git a/cms/generate.py b/cms/generate.py index b4f4ae2..16c2029 100644 --- a/cms/generate.py +++ b/cms/generate.py @@ -5,16 +5,17 @@ import sys import shutil import requests from jinja2 import Environment, FileSystemLoader +import dateutil.parser as dt from staticfiles import copy_dir -WIKI_URL = "https://events.ccc.de/congress/2017/wiki/api.php?action=parse&page=Assembly:CSOC&format=json&prop=text" +WIKI_URL = 'https://events.ccc.de/congress/2017/wiki/api.php?action=parse&page=Assembly:CSOC&format=json&prop=text' -FLIGHTPLAN_URL = "https://fahrplan.events.ccc.de/congress/2017/Fahrplan/schedule.json" -MISSION_CREW = ['Tim Pritlove', 'Charles Stross', 'Mathias Dalheimer', 'ktemkin'] +FLIGHTPLAN_URL = 'https://frab.txtfile.eu/en/34c3-ffc/public/schedule.json' +MISSION_CREW = ['VanillaChief', 'TP1024', 'Nikos Roussos', 'Pierros Papadeas', 'ar3itrary'] -STATIC_FILES_DIR = "static/" -TEMPLATE_DIR = "templates" +STATIC_FILES_DIR = 'static/' +TEMPLATE_DIR = 'templates' BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -57,10 +58,17 @@ def generate_flightplan(jinja_env, output_dir): for room in day['rooms'].values(): for lecture in room: persons = lecture['persons'] - if any([person['public_name'] in MISSION_CREW for person in persons]): + if any(person['public_name'] in MISSION_CREW for person in persons): + lecture['day'] = day['index'] + lecture['date'] = dt.parse(lecture['date']) lectures += [lecture] + page = { + 'title': 'Flightplan', + 'schedule' : lectures + } + + render_to_file(jinja_env, 'schedule.html', page, 'schedule.html', output_dir) - print(lectures) def main(): if len(sys.argv) != 2: diff --git a/cms/static/stylesheet.css b/cms/static/stylesheet.css index 5f9251c..aaf5f49 100644 --- a/cms/static/stylesheet.css +++ b/cms/static/stylesheet.css @@ -111,3 +111,12 @@ h3 { font-family: 'Source Code Pro'; margin-bottom: 5px; } + +.lecture .subtitle { + font-weight: bold; + font-family: 'Source Code Pro'; +} + +.lecture .infos { + font-family: 'Source Code Pro'; +} diff --git a/cms/templates/base.html b/cms/templates/base.html new file mode 100644 index 0000000..638449a --- /dev/null +++ b/cms/templates/base.html @@ -0,0 +1,39 @@ + + + + + {% block head %} + Chaos Space Operation Center - {{ title }} + + + + + + + + + {% endblock %} + + + + + + + + + + + + +
+
+ + {% block content %} + {% endblock %} +
+
+ + + diff --git a/cms/templates/index.html b/cms/templates/index.html index a030317..7e1cb99 100644 --- a/cms/templates/index.html +++ b/cms/templates/index.html @@ -1,37 +1,6 @@ - - - - - Chaos Space Operation Center - {{ title }} - +{% extends "base.html" %} - - - - - - - - - - - - - - - - - - -
-
- -

Chaos Space Operation Center

- {{text['*']}} -
-
- - - +{% block content %} +

Chaos Space Operation Center

+ {{text['*']}} +{% endblock %} diff --git a/cms/templates/schedule.html b/cms/templates/schedule.html new file mode 100644 index 0000000..b775eba --- /dev/null +++ b/cms/templates/schedule.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + +{% block content %} +

Chaos Space Operation Center

+

Flightplan

+ + {% for lecture in schedule %} +
+

{{lecture.title}}

+ {% if lecture.subtitle %} + {{lecture.subtitle}}
+ {% endif %} + + Day {{lecture.day}} - {{lecture.start}} ({{lecture.duration}}) :: {{lecture.room}}
+ {{ lecture.persons | join(', ', attribute='public_name') }} +
+ {{lecture.description}} +
+ {% endfor %} + + +{% endblock %}