diff --git a/app.py b/app.py index 0add273..377420b 100755 --- a/app.py +++ b/app.py @@ -25,17 +25,30 @@ def format_date_string(date_string): return date.strftime("%d. %B %Y") +def sort_date_from_string(date_string): + try: + return datetime.strptime(date_string.split('-')[0].strip(), "%d.%m.%Y") + except: + return datetime.now() + + # create app app = Flask(__name__) -app.config['FLATPAGES_EXTENSION'] = '.md' -app.config['FLATPAGES_HTML_RENDERER'] = markdown_with_jinja_renderer +app.config['FLATPAGES_PAGES_EXTENSION'] = '.md' +app.config['FLATPAGES_PAGES_HTML_RENDERER'] = markdown_with_jinja_renderer + +app.config['FLATPAGES_EVENTS_EXTENSION'] = '.md' +app.config['FLATPAGES_EVENTS_HTML_RENDERER'] = markdown_with_jinja_renderer +app.config['FLATPAGES_EVENTS_ROOT'] = 'events' + app.config['FONTAWESOME_STYLES'] = ['solid', 'brands'] # register fotogrid with jinja app.jinja_env.globals.update(fotogrid=fotogrid) app.jinja_env.globals.update(format_date_string=format_date_string) -pages = FlatPages(app) +pages = FlatPages(app, name="pages") +events = FlatPages(app, name="events") fa = FontAwesome(app) @@ -50,6 +63,13 @@ def verein(): return render_template('verein.html') +@app.route('/events.html') +def view_events(): + posts = [p for p in events if "date" in p.meta] + sorted_events = sorted(posts, reverse=False, key=lambda event: sort_date_from_string(event.meta["date"])) + return render_template('events.html', events=sorted_events) + + @app.route('/kontakt.html') def kontakt(): return render_template('kontakt.html') @@ -70,7 +90,7 @@ def impressum(): def index(): posts = [p for p in pages if "date" in p.meta] sorted_pages = sorted(posts, reverse=True, key=lambda page: - datetime.strptime(page.meta["date"], "%d.%m.%Y")) + sort_date_from_string(page.meta["date"])) return render_template('index.html', pages=sorted_pages) diff --git a/events/breeze2021.md b/events/breeze2021.md new file mode 100644 index 0000000..3c215de --- /dev/null +++ b/events/breeze2021.md @@ -0,0 +1,11 @@ +title: Summerbreeze +date: 18.08.2021 - 21.08.2021 +author: Markus +event: Festival +location: Dinkelsbühl +link: https://www.summer-breeze.de +pic: https://www.summer-breeze.de/wp-content/themes/summer-breeze-2021/assets/year-600.jpg +description: Summerbreeze +attending: Merry, Dieter, Ramona, Johannes, Anja, Markus + +Das Summerbreeze in Dinkelsbühl ist schon eine richtige FdgL-Institution \ No newline at end of file diff --git a/events/christmasbash2021.md b/events/christmasbash2021.md new file mode 100644 index 0000000..a1317f0 --- /dev/null +++ b/events/christmasbash2021.md @@ -0,0 +1,11 @@ +title: Christmas Bash +date: 03.12.2021 - 04.12.2021 +author: Markus +event: Festival +location: Eventzentrum Strohofer, Geiselwind +link: https://www.christmasbash.de +pic: https://www.christmasbash.de/images/2020/CMB21_Logo_600.png +description: The Return of the Bashman +attending: Anja, Markus + +Das Winterfestival in Franken, jedes Jahr im Dezember. \ No newline at end of file diff --git a/events/growl2021.md b/events/growl2021.md new file mode 100644 index 0000000..381037c --- /dev/null +++ b/events/growl2021.md @@ -0,0 +1,13 @@ +title: Growl-Workshop mit Britta +date: n/a +author: Markus +event: Workshop +fdglevent: ja +location: Halle96 +link: /growl-workshop.html +pic: +description: Lernt Growlen, Screamen, Grunten wie die Großen! +attending: Britta Görtz + +Lernt Growlen, Screamen, Grunten wie die Großen! +Im FdgL-Growl-Workshop mit Britta Görz von Critical Mess. \ No newline at end of file diff --git a/events/paradise2021.md b/events/paradise2021.md new file mode 100644 index 0000000..b280a9f --- /dev/null +++ b/events/paradise2021.md @@ -0,0 +1,12 @@ +title: Metal Hammer Paradise +date: 12.11.2021 - 13.11.2021 +author: Markus +event: Festival +location: Ferienpark Weissenhäuser Strand +link: https://www.metal-hammer-paradise.de +pic: /static/img/events/mhp_2021.jpg +description: Indoor-Festival im Ferienpark +attending: Anja, Markus, Claudia, Dieter + +Das Metal Hammer Paradise ist ein familiäres Indoor-Festival, +das im Ferienpark Weissenhäuser Strand an der Ostsee stattfindet. \ No newline at end of file diff --git a/events/wacken2021.md b/events/wacken2021.md new file mode 100644 index 0000000..28c3332 --- /dev/null +++ b/events/wacken2021.md @@ -0,0 +1,11 @@ +title: Wacken +date: 29.07.2021 - 31.07.2021 +author: Markus +event: Festival +location: Wacken +link: https://www.wacken.com +pic: https://www.wacken.com/typo3conf/ext/tnt_template_bs4/Resources/Public/2021/Images/logo_1x-min.png +description: Das größte Metal-Festival in Deutschland +attending: n/a + +Auf dem W:O:A könnt ihr auch Freund:innen des geordneten Lärms antreffen. \ No newline at end of file diff --git a/static/css/events.css b/static/css/events.css new file mode 100644 index 0000000..f128f17 --- /dev/null +++ b/static/css/events.css @@ -0,0 +1,57 @@ +/* + The event container uses flex layout to arrange the different events as cards. + */ +.event-container { + display: flex; + flex-wrap: wrap; +} + +/* + Each event card displays an event in a nice way as a card. + */ +.event-card { + border-style: solid; + border-width: 3px; + border-color: black; + border-radius: 9px; + margin: 4px 4px 4px 1px; + padding-left: 8px; + padding-right: 8px; +} + +.event-card img { + width: 100%; +} + +.attending { + font-size: 0.8rem; + color: #c11012; +} + +.attendee { + color: #515151; +} + +.event-type { + text-transform: uppercase; + color: white; + background: #c11012; + padding-left: 2px; + padding-right: 2px; +} + +.event-type-fdgl { + color: #c11012; + background: white; + border-style: dotted; + border-color: #c11012; + border-width: 1px; + padding-left: 2px; + padding-right: 2px; +} + +@media (min-width: 54rem) { + .event-card { + max-width: 40%; + } +} \ No newline at end of file diff --git a/static/css/style.css b/static/css/style.css index def409b..0a620cc 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -161,12 +161,12 @@ img[src $= "#illustration"] { /* Display an external icon after each link that leads away from our site. */ -.content a[href^="http://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after, -.content a[href^="https://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after { +.content a[href^="http://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):not([href*="#hideextern"]):after, +.content a[href^="https://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):not([href*="#hideextern"]):after { font-family: 'Font Awesome 5 Free'; content: "\f35d"; - display: inline-block; + display: inline-block;e font: normal 16px/1 'Font Awesome 5 Free'; margin-left: 4px; } diff --git a/static/img/events/mhp_2021.jpg b/static/img/events/mhp_2021.jpg new file mode 100644 index 0000000..f7cb2c3 Binary files /dev/null and b/static/img/events/mhp_2021.jpg differ diff --git a/templates/events.html b/templates/events.html new file mode 100644 index 0000000..6f507d6 --- /dev/null +++ b/templates/events.html @@ -0,0 +1,34 @@ +{% extends "template.html" %} + +{% block title %} + Was liegt an? +{% endblock %} +{% block content %} +
+ + {% for event in events %} +
+

{{ event.title }}

+ +

 {{ event.date }}

+ {{ event.event }} + {% if event.fdglevent == 'ja' %} +  FdgL Event + {% endif %} +

{{ event.html|safe }}

+

vor Ort: + {% for a in event.attending.split(',') %} + {{ a }}{% if a != event.attending.split(',')[-1] %},{% endif %} + {% endfor %} +

+
+ {% endfor %} + +
+{% endblock %} diff --git a/templates/index.html b/templates/index.html index e799d43..baa59f6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,6 +7,6 @@

{{ page.title }}

{{ page.description }}

{{ format_date_string(page.date) }}

-
+
{% endfor %} {% endblock %} diff --git a/templates/template.html b/templates/template.html index be33889..202fd1b 100644 --- a/templates/template.html +++ b/templates/template.html @@ -5,6 +5,7 @@ {{ fontawesome_html() }} + FdgL - Freunde des geordneten Lärms @@ -23,8 +24,9 @@