From 62c52b1c684e0c8c044b42974704b6f6661b3320 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 15 Jun 2020 21:40:36 +0200 Subject: [PATCH] separate html and javascript code the function hide was in the header.html file enclosed by script tags. it has been moved to the theme.js file. to make it run it was necessary to add a entry point to the WebpackThemeBundle instance in webpack.py (render the js file) and include the resulting js file manually in footer.html (to be loaded in the browser). --- .../semantic-ui/js/invenio_theme_tugraz/theme.js | 11 +++++++++++ .../templates/invenio_theme_tugraz/footer.html | 4 ++++ .../templates/invenio_theme_tugraz/header.html | 14 -------------- invenio_theme_tugraz/webpack.py | 2 ++ 4 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/theme.js diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/theme.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/theme.js new file mode 100644 index 0000000..4068a46 --- /dev/null +++ b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/theme.js @@ -0,0 +1,11 @@ +export function hide() { + var x = document.getElementById('heading'); + + if (x.style.display === "none") { + x.style.display = "block"; + } else { + x.style.display = "none"; + } +} + +window.hide = hide; diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html index 1f99b70..1959de9 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html @@ -12,6 +12,10 @@ {{ webpack['invenio-theme-tugraz-theme.css'] }} {%- endblock %} +{%- block javascript %} + {{ webpack['invenio-theme-tugraz-js.js'] }} +{%- endblock javascript %} +