]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/expand-toggle.js
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / resources / js / components / expand-toggle.js
index ab4d38ab1df2224270a27aab2f1fca6ae3786e10..29173a058293d99f88ed25390892961ea39e92e1 100644 (file)
@@ -1,9 +1,9 @@
-import {slideUp, slideDown} from "../services/animations";
-import {Component} from "./component";
+import {slideUp, slideDown} from '../services/animations.ts';
+import {Component} from './component';
 
 export class ExpandToggle extends Component {
 
-    setup(elem) {
+    setup() {
         this.targetSelector = this.$opts.targetSelector;
         this.isOpen = this.$opts.isOpen === 'true';
         this.updateEndpoint = this.$opts.updateEndpoint;
@@ -24,8 +24,9 @@ export class ExpandToggle extends Component {
         event.preventDefault();
 
         const matchingElems = document.querySelectorAll(this.targetSelector);
-        for (let match of matchingElems) {
-            this.isOpen ?  this.close(match) : this.open(match);
+        for (const match of matchingElems) {
+            const action = this.isOpen ? this.close : this.open;
+            action(match);
         }
 
         this.isOpen = !this.isOpen;
@@ -34,8 +35,8 @@ export class ExpandToggle extends Component {
 
     updateSystemAjax(isOpen) {
         window.$http.patch(this.updateEndpoint, {
-            expand: isOpen ? 'true' : 'false'
+            expand: isOpen ? 'true' : 'false',
         });
     }
 
-}
\ No newline at end of file
+}