wip: programme

This commit is contained in:
mco-system
2023-04-09 13:38:07 +11:00
parent 33a1cc2e7f
commit fb14588521
15 changed files with 256 additions and 251 deletions

View File

@@ -1,3 +1,4 @@
import re
import sys
import json
import logging
@@ -6,6 +7,7 @@ import yaml
from flask import Flask, render_template, redirect, request, url_for
from thsf.backend import Backend
from thsf.schedule import Schedule
from thsf.navbar import Navbar
# ------------------------------------------------------------------------------
@@ -37,6 +39,7 @@ try:
apiprefix=app.local_config["pretalx"]["apiprefix"],
apikey=app.local_config["pretalx"]["apikey"])
schedule = Schedule()
navbar = Navbar(config=app.local_config["navbar"])
except Exception as err:
logger.critical("[{}] {}".format(err.__class__, str(err)))
sys.exit(1)
@@ -73,6 +76,8 @@ def date2dmyhm(slot_type):
"Atelier": "fa-solid fa-screwdriver-wrench",
"Exposition": "fa-solid fa-palette"}
return slot_types[slot_type]
# ------------------------------------------------------------------------------
# -- Routes
# ------------------------------------------------------------------------------
@@ -83,63 +88,60 @@ def favicon():
@app.route('/', methods=['GET'])
def index():
return render_template("index.html")
return render_template("index.html",
navbar=navbar.get_from_page(page="/"))
@app.route('/planning', methods=['GET'])
def planning():
slots = backend.get(endpoint=f"events/{app.local_config['pretalx']['event']}/schedules/{app.local_config['pretalx']['schedule']}").json()
# schedule.set_slots(slots["slots"])
return render_template("planning.html", slots=slots["slots"])
# return "toto"
# for slot in sched["slots"]:
# schedule.add_slot(slot)
# return schedule.df.to_html()
return render_template("planning.html",
slots=slots["slots"],
navbar=navbar.get_from_page(page="/planning"))
@app.route('/place', methods=['GET'])
def place():
return render_template("index.html",
navbar=navbar.get_from_page(page="/place"))
@app.route('/food', methods=['GET'])
def food():
return render_template("index.html",
navbar=navbar.get_from_page(page="/food"))
@app.route('/goodies', methods=['GET'])
def goodies():
return render_template("index.html",
navbar=navbar.get_from_page(page="/goodies"))
@app.route('/concerts', methods=['GET'])
def concerts():
return "concerts"
@app.route('/djsets', methods=['GET'])
def djsets():
return "djsets"
@app.route('/exhibitions', methods=['GET'])
def exhibitions():
return "exhibitions"
@app.route('/lighttalks', methods=['GET'])
def lighttalks():
return "lighttalks"
@app.route('/paneldiscussions', methods=['GET'])
def paneldiscussions():
return "paneldiscussions"
@app.route('/screenings', methods=['GET'])
def screenings():
return "screenings"
@app.route('/talks', methods=['GET'])
def talks():
return "talks"
return render_template("index.html",
navbar=navbar.get_from_page(page="/concerts"))
@app.route('/workshops', methods=['GET'])
def workshops():
return "workshops"
return render_template("index.html",
navbar=navbar.get_from_page(page="/workshops"))
@app.route('/screenings', methods=['GET'])
def screenings():
return render_template("index.html",
navbar=navbar.get_from_page(page="/screenings"))
@app.route('/discussions', methods=['GET'])
def discussions():
return render_template("index.html",
navbar=navbar.get_from_page(page="/discussions"))
@app.route('/exhibitions', methods=['GET'])
def exhibitions():
return render_template("index.html",
navbar=navbar.get_from_page(page="/exhibitions"))
@app.route('/talks', methods=['GET'])
def talks():
return render_template("index.html",
navbar=navbar.get_from_page(page="/talks"))
# ------------------------------------------------------------------------------