From 254f94cb6bbca8557c7e76cba41d18c005b1f660 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 30 Sep 2019 16:38:12 +0200 Subject: [PATCH] Fix menu in settings/admin pages --- .../flavours/glitch/packs/settings.js | 20 +++++++++++++++++++ app/javascript/flavours/glitch/theme.yml | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 app/javascript/flavours/glitch/packs/settings.js diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js new file mode 100644 index 0000000000..b32f38226c --- /dev/null +++ b/app/javascript/flavours/glitch/packs/settings.js @@ -0,0 +1,20 @@ +import loadPolyfills from 'flavours/glitch/util/load_polyfills'; +import ready from 'flavours/glitch/util/ready'; + +function main() { + const { delegate } = require('rails-ujs'); + + delegate(document, '.sidebar__toggle__icon', 'click', () => { + const target = document.querySelector('.sidebar ul'); + + if (target.style.display === 'block') { + target.style.display = 'none'; + } else { + target.style.display = 'block'; + } + }); +} + +loadPolyfills().then(main).catch(error => { + console.error(error); +}); diff --git a/app/javascript/flavours/glitch/theme.yml b/app/javascript/flavours/glitch/theme.yml index 06e26ade26..0fd627f194 100644 --- a/app/javascript/flavours/glitch/theme.yml +++ b/app/javascript/flavours/glitch/theme.yml @@ -18,7 +18,7 @@ pack: mailer: modal: public: packs/public.js - settings: + settings: packs/settings.js share: packs/share.js # (OPTIONAL) The directory which contains localization files for