From 39f10c1c7c0c35a31a3eaa98835a3056bdcfd19b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 4 Jul 2022 20:06:04 +0100 Subject: [PATCH] Add shareon --- package-lock.json | 18 +++++++++++++++++- package.json | 3 ++- scripts/copy-npm-contrib.sh | 1 + static/src/scss/_homepage.scss | 1 + static/src/scss/_shareon.scss | 3 +++ static/src/scss/base.scss | 3 ++- .../common/templates/common/content_page.html | 4 ++++ website/common/templates/common/shareon.html | 19 +++++++++++++++++++ website/common/templatetags/util_tags.py | 6 ++++++ 9 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 static/src/scss/_shareon.scss create mode 100644 website/common/templates/common/shareon.html diff --git a/package-lock.json b/package-lock.json index 8447f1e..2137d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "bulma": "^0.9.4", "darkreader": "^4.9.51", "elevator.js": "^1.0.1", - "lite-youtube-embed": "^0.2.0" + "lite-youtube-embed": "^0.2.0", + "shareon": "^2.0.0" }, "devDependencies": { "esbuild": "^0.14.43", @@ -1374,6 +1375,16 @@ "semver": "bin/semver" } }, + "node_modules/shareon": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shareon/-/shareon-2.0.0.tgz", + "integrity": "sha512-vwNQFAruIFjN/TOoDeMm8x7TZ1KC/1hPFnIwQpoX6vu+cYjzAmaP9KCmcZaIu/cvBFp2X24+0OrUcbR3uKk7Bw==", + "funding": [ + "https://github.com/sponsors/kytta/", + "https://liberapay.com/kytta", + "https://www.paypal.com/paypalme/NickKaramoff" + ] + }, "node_modules/shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -2484,6 +2495,11 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "shareon": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shareon/-/shareon-2.0.0.tgz", + "integrity": "sha512-vwNQFAruIFjN/TOoDeMm8x7TZ1KC/1hPFnIwQpoX6vu+cYjzAmaP9KCmcZaIu/cvBFp2X24+0OrUcbR3uKk7Bw==" + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", diff --git a/package.json b/package.json index a022b23..c2ea4a9 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "bulma": "^0.9.4", "darkreader": "^4.9.51", "elevator.js": "^1.0.1", - "lite-youtube-embed": "^0.2.0" + "lite-youtube-embed": "^0.2.0", + "shareon": "^2.0.0" } } diff --git a/scripts/copy-npm-contrib.sh b/scripts/copy-npm-contrib.sh index de1ed17..42b1eea 100755 --- a/scripts/copy-npm-contrib.sh +++ b/scripts/copy-npm-contrib.sh @@ -17,3 +17,4 @@ mkcontrib() { mkcontrib fontawesome node_modules/@fortawesome/fontawesome-free/{css,webfonts} mkcontrib elevator-js node_modules/elevator.js/demo/music/* +mkcontrib shareon node_modules/shareon/dist/{shareon.iife.*,shareon.min.css*} diff --git a/static/src/scss/_homepage.scss b/static/src/scss/_homepage.scss index a9f0c16..064416a 100644 --- a/static/src/scss/_homepage.scss +++ b/static/src/scss/_homepage.scss @@ -9,6 +9,7 @@ body.page-home-homepage { align-items: center; flex-direction: column; color: $white; + margin-bottom: 0; } h1 { diff --git a/static/src/scss/_shareon.scss b/static/src/scss/_shareon.scss new file mode 100644 index 0000000..90c4054 --- /dev/null +++ b/static/src/scss/_shareon.scss @@ -0,0 +1,3 @@ +.shareon-container { + margin-top: 1rem; +} diff --git a/static/src/scss/base.scss b/static/src/scss/base.scss index f6276bc..11d8e98 100644 --- a/static/src/scss/base.scss +++ b/static/src/scss/base.scss @@ -10,6 +10,7 @@ @import "content"; @import "listing"; @import "blocks"; +@import "shareon"; html, body { @@ -19,5 +20,5 @@ body { } main { - margin-bottom: 1rem; + margin-bottom: 2rem; } diff --git a/website/common/templates/common/content_page.html b/website/common/templates/common/content_page.html index 6a92e9b..c06adcd 100644 --- a/website/common/templates/common/content_page.html +++ b/website/common/templates/common/content_page.html @@ -10,13 +10,17 @@ {{ page.body_html|safe }} +{% include "common/shareon.html" %} + {% endblock %} {% block extra_css %} + {% endblock %} {% block extra_js %} + {% endblock %} diff --git a/website/common/templates/common/shareon.html b/website/common/templates/common/shareon.html new file mode 100644 index 0000000..0494c69 --- /dev/null +++ b/website/common/templates/common/shareon.html @@ -0,0 +1,19 @@ +{% load util_tags %} + +
+

Share this page

+
+ + + + + + + + + + + + +
+
diff --git a/website/common/templatetags/util_tags.py b/website/common/templatetags/util_tags.py index 2f71243..bb721aa 100644 --- a/website/common/templatetags/util_tags.py +++ b/website/common/templatetags/util_tags.py @@ -1,4 +1,5 @@ from django.template import Library +from wagtail.models import Page register = Library() @@ -6,3 +7,8 @@ register = Library() @register.filter(name="range") def do_range(stop: int) -> range: return range(stop) + + +@register.simple_tag(takes_context=True) +def pagefullurl(context: dict, page: Page) -> str: + return page.get_full_url(context["request"])