]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/entity-permissions.js
respective book and chapter structure added.
[bookstack] / resources / js / components / entity-permissions.js
index 0dec5ca0937dda6620122628e5aef22b5ccd8013..7ab99a2a70bb2f45445d485b6aff49e018b25d7b 100644 (file)
@@ -1,9 +1,7 @@
-/**
- * @extends {Component}
- */
-import {htmlToDom} from "../services/dom";
+import {htmlToDom} from '../services/dom';
+import {Component} from './component';
 
-class EntityPermissions {
+export class EntityPermissions extends Component {
 
     setup() {
         this.container = this.$el;
@@ -31,12 +29,12 @@ class EntityPermissions {
         this.container.addEventListener('click', event => {
             const button = event.target.closest('button');
             if (button && button.dataset.roleId) {
-                this.removeRowOnButtonClick(button)
+                this.removeRowOnButtonClick(button);
             }
         });
 
         // Role select change
-        this.roleSelect.addEventListener('change', event => {
+        this.roleSelect.addEventListener('change', () => {
             const roleId = this.roleSelect.value;
             if (roleId) {
                 this.addRoleRow(roleId);
@@ -63,8 +61,8 @@ class EntityPermissions {
 
     removeRowOnButtonClick(button) {
         const row = button.closest('.item-list-row');
-        const roleId = button.dataset.roleId;
-        const roleName = button.dataset.roleName;
+        const {roleId} = button.dataset;
+        const {roleName} = button.dataset;
 
         const option = document.createElement('option');
         option.value = roleId;
@@ -75,5 +73,3 @@ class EntityPermissions {
     }
 
 }
-
-export default EntityPermissions;
\ No newline at end of file