add program page and sample data

This commit is contained in:
Lyn Fugmann 2024-09-26 15:39:47 +02:00
parent 5c77536d98
commit e31972cb90
7 changed files with 163 additions and 24 deletions

71
_includes/program.njk Normal file
View file

@ -0,0 +1,71 @@
---js
{
layout: "page.njk",
getLocalized: function(item) {
if (typeof item === "string") return item;
return item[this.ctx.lang];
},
toDate: function(dateStr) {
return new Date(dateStr);
}
}
---
{{ content | safe }}
{% for date, events in program %}
<section>
<h2 id="{{ date }}">
{{ toDate(date).toLocaleDateString(lang, { weekday: 'long', month: 'short', day: 'numeric' }) }}
</h2>
<ul>
{% for event in events %}
<li class="timeslot">
<h3 id="{{date}}_{{loop.index}}">
{{ "🔴 " if event.livestream -}}
{{ getLocalized(event.title) }}
</h3>
<div class="timeslot-time">
<span class="start">{{ event.start }}</span>
{% if event.end %}
<span class="end"> {{ event.end }}</span>
{% endif %}
</div>
<p>{{ getLocalized(event.description) }}</p>
{% if event.annotation %}
<p class="annotation">
{{ getLocalized(event.annotation) }}
</p>
{% endif %}
{% if event.location %}
<p class="location">
{{ getLocalized(event.location) }}
</p>
{% endif %}
{% if event.checkin_link %}
<a class="btn"
{% if event.checkin_link.startsWith("http") %}
href="{{ event.checkin_link }}"
target="_blank"
rel="noreferrer"
{% else %}
href="{{ event.checkin_link | locale_url }}"
{% endif %}
>
Check-in
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endfor %}
{% css %}
.timeslot {
display: block;
}
{% endcss %}

View file

@ -0,0 +1,51 @@
"2024-10-07": # NOTE: quoting dates is important
- start: "09:00"
end: "10:30"
title:
de: "Begrüßung"
en: "Grand Opening"
description:
de: "blabla"
en: "bibibababubu"
location: "HSZ/004"
# annotation: null
checkin_link: "https://kurse.ifsr.de/..."
livestream: true
- start: "10:30"
end: "14:00"
title:
de: "Tutorien und Mittagessen"
en: "Tutorial and lunch"
description:
de: "hocus"
en: "pocus"
location: "Start: HSZ"
annotation:
de: "Der Stream verzögert sich um 20 Minuten"
en: "The Livesream will be delayed by 20 minutes."
# checkin_link: null
# livestream: false # NOTE: can be omitted
"2024-10-08":
- start: "10:30"
end: "16:00"
title: "Nerd101" # NOTE: same value for all langs
description:
de: "coole vorträge"
en: "cool talks"
location: "Andreas-Pfitzmann-Bau (APB)"
# annotation: null
checkin_link: "/campus/" # NOTE: local url (needs to exist)
livestream: true
- start: "19:00"
end: null # NOTE: open end
title:
de: "Clubwanderung"
en: "Club tour"
description:
de: "lorem"
en: "ipsum"
location: "Start: APB"
annotation:
de: "Bargeld mitbringen!!!!11!1"
en: "Bring cash!!!!11!1"
checkin_link: "https://kurse.ifsr.de/..."

View file

@ -1,5 +1,5 @@
---
layout: page.njk
layout: program.njk
title: Programm
tags: mainNav
eleventyNavigation:

View file

@ -1,5 +1,5 @@
---
layout: page.njk
layout: program.njk
title: Program
tags: mainNav
eleventyNavigation:

View file

@ -2,6 +2,7 @@ const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy")
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const bundlerPlugin = require("@11ty/eleventy-plugin-bundle");
const pluginIcons = require('eleventy-plugin-icons');
const yaml = require("js-yaml");
const fs = require('fs');
// update this :)
@ -24,6 +25,8 @@ module.exports = function(eleventyConfig) {
],
});
eleventyConfig.addDataExtension("yaml, yml", yaml.load);
eleventyConfig.addGlobalData("year", year);
eleventyConfig.addGlobalData("eseColor", eseColor);
@ -53,7 +56,6 @@ module.exports = function(eleventyConfig) {
dir: {
input: "content",
includes: "../_includes",
data: "../_data",
},
pathPrefix: `/${year}/`,
}

54
package-lock.json generated
View file

@ -13,7 +13,8 @@
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-bundle": "^1.0.5",
"@fortawesome/fontawesome-free": "^6.6.0",
"eleventy-plugin-icons": "^4.5.1"
"eleventy-plugin-icons": "^4.5.1",
"js-yaml": "^4.1.0"
}
},
"node_modules/@11ty/dependency-tree": {
@ -387,14 +388,11 @@
}
},
"node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"sprintf-js": "~1.0.2"
}
"license": "Python-2.0"
},
"node_modules/array-differ": {
"version": "3.0.0",
@ -1226,6 +1224,30 @@
"node": ">=6.0"
}
},
"node_modules/gray-matter/node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"license": "MIT",
"dependencies": {
"sprintf-js": "~1.0.2"
}
},
"node_modules/gray-matter/node_modules/js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/hamljs": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/hamljs/-/hamljs-0.6.2.tgz",
@ -1576,14 +1598,13 @@
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
@ -1723,13 +1744,6 @@
"markdown-it": "bin/markdown-it.js"
}
},
"node_modules/markdown-it/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "Python-2.0"
},
"node_modules/maximatch": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz",

View file

@ -14,6 +14,7 @@
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-bundle": "^1.0.5",
"@fortawesome/fontawesome-free": "^6.6.0",
"eleventy-plugin-icons": "^4.5.1"
"eleventy-plugin-icons": "^4.5.1",
"js-yaml": "^4.1.0"
}
}