mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 17:22:17 +00:00
Cleanup calendar CSS/JS load order
This commit is contained in:
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
{{ block "extra_css" . }}
|
||||||
|
{{ end }}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="top" class="">
|
<body id="top" class="">
|
||||||
@@ -62,6 +64,8 @@
|
|||||||
|
|
||||||
{{ partial "footer.html" .}}
|
{{ partial "footer.html" .}}
|
||||||
{{ partial "foot.html" .}}
|
{{ partial "foot.html" .}}
|
||||||
|
{{ block "extra_js" . }}
|
||||||
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -6,43 +6,19 @@
|
|||||||
{{ .Params.subtitle }}
|
{{ .Params.subtitle }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "content" }}
|
{{ define "extra_css" }}
|
||||||
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
|
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "extra_js" }}
|
||||||
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
|
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
|
||||||
<div id="calendar" style="height: 800px"></div>
|
|
||||||
<script>
|
<script>
|
||||||
/* in the browser environment namespace */
|
$(document).ready(function () {
|
||||||
const Calendar = tui.Calendar;
|
render_calendar();
|
||||||
const calendar = new Calendar('#calendar', {
|
|
||||||
defaultView: 'month',
|
|
||||||
isReadOnly: true,
|
|
||||||
useDetailPopup: true,
|
|
||||||
usageStatistics: false,
|
|
||||||
calendars: [
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
name: 'Hackspace Events',
|
|
||||||
backgroundColor: '#ff0000',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(calendar.getEvent());
|
|
||||||
|
|
||||||
$.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();
|
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "content" }}
|
||||||
|
<div id="calendar" style="height: 800px"></div>
|
||||||
|
{{ end }}
|
||||||
Reference in New Issue
Block a user