mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-13 12:12:18 +00:00
Move site specific layouts and JS to the site folders
This commit is contained in:
38
assets/js/site.js
Normal file
38
assets/js/site.js
Normal file
@@ -0,0 +1,38 @@
|
||||
function titleCase(word) {
|
||||
return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
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);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -2,6 +2,8 @@
|
||||
title: Join Leigh Hackspace
|
||||
subtitle: Become part of our community.
|
||||
hero_image: /images/hero-img.svg
|
||||
layout: membership
|
||||
show_cta: False
|
||||
---
|
||||
Leigh Hackspace is a social enterprise created for the benefit of our members and the wider Leigh community. We depend on memberships and grants to operate, and in return we offer members access to the hackspace's facilities and resources.
|
||||
|
||||
@@ -9,6 +11,4 @@ Being a member is being part of a social making and learning community. Our memb
|
||||
|
||||
We suggest that you [visit the hackspace]({{< ref "/visit" >}}) in person before you commit to be a member. This will allow you to see the space, understand what is available, and how it can work for you. We have further information on our [wiki](https://wiki.leighhack.org/membership/joining/).
|
||||
|
||||
{{< memberships >}}
|
||||
|
||||
All memberships are collected on the 1st of the month, but if you wish to arrange an alternative date then please [contact us](mailto:info@leighhack.org).
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: "Thank You, and Welcome!"
|
||||
subtitle: "You're now a member."
|
||||
draft: false
|
||||
show_cta: false
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{{ define "content" }}
|
||||
{{ .Content }}
|
||||
|
||||
<div class="columns pricing-tiers is-centered is-multiline">
|
||||
{{- with $.Site.Data.memberships.membership_levels }}
|
||||
{{ range . -}}
|
||||
@@ -17,3 +20,4 @@
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -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,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>
|
||||
Reference in New Issue
Block a user