]> cat aescling's git repositories - mastodon.git/commitdiff
Fix menu in settings/admin pages
authorThibaut Girka <thib@sitedethib.com>
Mon, 30 Sep 2019 14:38:12 +0000 (16:38 +0200)
committerThibaut Girka <thib@sitedethib.com>
Mon, 30 Sep 2019 15:01:16 +0000 (17:01 +0200)
app/javascript/flavours/glitch/packs/settings.js [new file with mode: 0644]
app/javascript/flavours/glitch/theme.yml

diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js
new file mode 100644 (file)
index 0000000..b32f382
--- /dev/null
@@ -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);
+});
index 06e26ade26eec1e5ac300f7160245c73a3553b07..0fd627f1949dcc9bd37717e6554dc6632c0eed2c 100644 (file)
@@ -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