diff --git a/themes/lhs/assets/js/site.js b/themes/lhs/assets/js/site.js index 6b6eae4..fc5cb57 100644 --- a/themes/lhs/assets/js/site.js +++ b/themes/lhs/assets/js/site.js @@ -22,5 +22,37 @@ $(document).ready(function () { } }); +function render_calendar() { + const calendar = new tui.Calendar('#calendar', { + defaultView: 'month', + isReadOnly: true, + useDetailPopup: true, + usageStatistics: false, + calendars: [ + { + id: '1', + name: 'Hackspace Events', + backgroundColor: '#ff0000', + }, + ], + }); + + $.getJSON('https://api.leighhack.org/events', function (data) { + data.forEach(function (event) { + calendar.createEvents([{ + id: event['uid'], + calendarId: '1', + title: event['summary'], + body: event['description'], + state: 'Free', + dueDateClass: '', + start: event['start']['dateTime'], + end: event['end']['dateTime'], + }]) + }); + }); + calendar.render(); +} + diff --git a/themes/lhs/layouts/_default/baseof.html b/themes/lhs/layouts/_default/baseof.html index de4dc86..bd67ad4 100644 --- a/themes/lhs/layouts/_default/baseof.html +++ b/themes/lhs/layouts/_default/baseof.html @@ -3,6 +3,8 @@ {{ partial "head.html" . }} + {{ block "extra_css" . }} + {{ end }} @@ -62,6 +64,8 @@ {{ partial "footer.html" .}} {{ partial "foot.html" .}} + {{ block "extra_js" . }} + {{ end }} \ No newline at end of file diff --git a/themes/lhs/layouts/page/calendar.html b/themes/lhs/layouts/page/calendar.html index 3294b2f..9c3578a 100644 --- a/themes/lhs/layouts/page/calendar.html +++ b/themes/lhs/layouts/page/calendar.html @@ -6,43 +6,19 @@ {{ .Params.subtitle }} {{ end }} -{{ define "content" }} +{{ define "extra_css" }} +{{ end }} + +{{ define "extra_js" }} -
+{{ end }} + +{{ define "content" }} +
{{ end }} \ No newline at end of file