about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-09-30 16:38:12 +0200
committerThibaut Girka <thib@sitedethib.com>2019-09-30 17:01:16 +0200
commit14f797873d86aed085dad2ff60c8dad2ab3d4b7b (patch)
treefb1894fcb7ac6d82debef3910e5897fa0428c695 /app/javascript/flavours
parentddee0dd3821746fb999a3459480e7507f03dc559 (diff)
Fix menu in settings/admin pages
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/packs/settings.js20
-rw-r--r--app/javascript/flavours/glitch/theme.yml2
2 files changed, 21 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js
new file mode 100644
index 000000000..b32f38226
--- /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 06e26ade2..0fd627f19 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