mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 03:22:17 +00:00
Move site specific layouts and JS to the site folders
This commit is contained in:
@@ -1,43 +1 @@
|
||||
function titleCase(word) {
|
||||
return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".navbar-burger").click(function () {
|
||||
$(".navbar-burger").toggleClass("is-active");
|
||||
$(".navbar-menu").toggleClass("is-active");
|
||||
});
|
||||
|
||||
if ($('span#hackspace-status').length) {
|
||||
$.getJSON("https://api.leighhack.org/space.json", function (data) {
|
||||
if (data.state.open) {
|
||||
message = '<b>Open<b>'
|
||||
if ('message' in data.state) {
|
||||
message = message + ': ' + data.state.message;
|
||||
}
|
||||
$('span#hackspace-status').html(message);
|
||||
$('div#hackspace-open').addClass('is-success');
|
||||
} else {
|
||||
$('span#hackspace-status').html('<b>Closed</b>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 'printers' shortcode
|
||||
if ($('div#printer-status').length) {
|
||||
$.getJSON("https://api.leighhack.org/space.json", function (data) {
|
||||
if (data.sensors.ext_3d_printers.length) {
|
||||
|
||||
// sort the printers
|
||||
const printers = Array.from(data.sensors.ext_3d_printers).sort((a, b) => a['name'].localeCompare(b['name']));
|
||||
|
||||
printers.forEach(function (val, indx){
|
||||
var obj = $($("template#printer-block").html());
|
||||
obj.find('#printer-name').html(val['name']);
|
||||
obj.find('#printer-status').html(titleCase(val['state']));
|
||||
$('div#printer-status').append(obj);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// This should be overridden in the site assets folder with any JS you need
|
||||
6
themes/lhs/assets/js/theme.js
Normal file
6
themes/lhs/assets/js/theme.js
Normal file
@@ -0,0 +1,6 @@
|
||||
$(document).ready(function () {
|
||||
$(".navbar-burger").click(function () {
|
||||
$(".navbar-burger").toggleClass("is-active");
|
||||
$(".navbar-menu").toggleClass("is-active");
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
{{ define "title" }}
|
||||
{{ .Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "subtitle" }}
|
||||
{{ .Params.subtitle }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "extra_css" }}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.css">
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "extra_js" }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@2.4.1/event-calendar.min.js" type="application/javascript"></script>
|
||||
<script type="application/javascript">
|
||||
var events = [];
|
||||
$(document).ready(function () {
|
||||
$.getJSON('https://api.leighhack.org/events', function (data) {
|
||||
data.forEach(function (event) {
|
||||
events.push({
|
||||
id: event['uid'],
|
||||
title: event['summary'],
|
||||
body: event['description'],
|
||||
state: 'Free',
|
||||
dueDateClass: '',
|
||||
start: event['start']['dateTime'],
|
||||
end: event['end']['dateTime'],
|
||||
})
|
||||
});
|
||||
let ec = new EventCalendar(document.getElementById('calendar'), {
|
||||
view: 'listMonth',
|
||||
events: events,
|
||||
headerToolbar: {
|
||||
start: 'prev,next today',
|
||||
center: 'title',
|
||||
end: 'dayGridMonth, listMonth'
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<div id="calendar"></div>
|
||||
{{ end }}
|
||||
@@ -1,23 +0,0 @@
|
||||
{{ define "hero-content" }}
|
||||
<h1 class="title is-1 has-text-white">{{ .Title }}</h1>
|
||||
<p class="subtitle has-text-white">{{ .Params.subtitle }}</p>
|
||||
|
||||
<div class="columns _is-desktop">
|
||||
<div class="column is-mobile is-multiline is-fullwidth-touch">
|
||||
<a class="button is-primary is-medium is-fullwidth has-box-shadow" href="{{ ref . "about" }}">Learn more</a>
|
||||
</div>
|
||||
<div class="column is-mobile is-multiline is-fullwidth-touch">
|
||||
<a class="button is-primary is-medium is-fullwidth has-box-shadow is-inverted _is-outlined"
|
||||
href="{{ ref . "membership" }}">Become a member</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "cta" }}
|
||||
{{ partial "design/bigcta.html" . }}
|
||||
{{ end }}
|
||||
@@ -1,6 +1,8 @@
|
||||
<script src="https://kit.fontawesome.com/7353d7e426.js" crossorigin="anonymous"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
|
||||
{{ $theme := resources.Get "js/theme.js" }}
|
||||
{{ $site := resources.Get "js/site.js" }}
|
||||
{{ $js := slice $site | resources.Concat "js/bundle.js" | resources.Minify }}
|
||||
{{ $js := slice $site $theme | resources.Concat "js/bundle.js" | resources.Minify }}
|
||||
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
|
||||
<script src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
|
||||
@@ -1,15 +0,0 @@
|
||||
<div class="columns pricing-tiers is-centered is-multiline">
|
||||
{{- range (where .Site.RegularPages "Section" "facilities") }}
|
||||
<div class="column is-one-quarter">
|
||||
<div class="box is-large hover-items">
|
||||
<h3 class="is-size-4 has-text-weight-bold">{{ .Title }}</h3>
|
||||
<div class="content mt-5 facility-description">
|
||||
<p>{{ .Params.subtitle }}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<a href="{{ .Permalink }}" class="button is-primary is-medium is-fullwidth has-box-shadow ">Learn More</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -1,19 +0,0 @@
|
||||
<div class="columns pricing-tiers is-centered is-multiline">
|
||||
{{- with $.Site.Data.memberships.membership_levels }}
|
||||
{{ range . -}}
|
||||
<div class="column is-one-quarter">
|
||||
<div class="box is-large hover-items">
|
||||
<h3 class="is-size-4 has-text-weight-bold">{{ .name }}</h3>
|
||||
<div class="is-size-1 has-text-weight-bold pricing-price">£{{ .price }}</div>
|
||||
<div class="_is-block mt-1 is-size-7 has-text-weight-normal">{{ default "per month" .period }}</div>
|
||||
<div class="content mt-5 pricing-description is-size-6">
|
||||
<p>{{ .description }}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<a href="{{ .link }}" class="button is-primary is-medium is-fullwidth has-box-shadow ">{{ default "Join Today" .button }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
@@ -1,10 +0,0 @@
|
||||
<template id="printer-block">
|
||||
<div class="column is-one-quarter">
|
||||
<div class="box">
|
||||
<h3 id="printer-name"></h3>
|
||||
<p id="printer-status"></p>
|
||||
<p class="is-hidden" id="printer-finish-block">ETA: <span id="printer-finish"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="columns is-centered" id="printer-status"></div>
|
||||
Reference in New Issue
Block a user