From 7e01a64e758b34f14f6123b09ee5a63231ca8acd Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 22 Nov 2022 23:37:04 +0000 Subject: [PATCH] Appease current coding standard See also https://github.com/magento/magento-coding-standard/pull/347 --- .../User/view/adminhtml/web/js/roles-tree.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js b/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js index a88b8589922c9..82cdc4ac49feb 100644 --- a/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js +++ b/app/code/Magento/User/view/adminhtml/web/js/roles-tree.js @@ -10,7 +10,7 @@ define([ 'jquery', 'jquery/ui', 'jquery/jstree/jquery.jstree', - 'mage/translate', + 'mage/translate' ], function ($) { 'use strict'; @@ -44,21 +44,21 @@ define([ }, _createButtons: function () { - const $tree = $.jstree.reference(this.element); + const $tree = $.jstree.reference(this.element), + collapseAllButton = document.createElement('button'), + expandAllButton = document.createElement('button'), + expandUsedButton = document.createElement('button'); - const collapseAllButton = document.createElement('button'); collapseAllButton.innerText = $.mage.__('Collapse all'); collapseAllButton.addEventListener('click', function () { $tree.close_all(); }); - const expandAllButton = document.createElement('button'); expandAllButton.innerText = $.mage.__('Expand all'); expandAllButton.addEventListener('click', function () { $tree.open_all(); }); - const expandUsedButton = document.createElement('button'); expandUsedButton.innerText = $.mage.__('Expand selected'); expandUsedButton.addEventListener('click', function () { const hasOpened = []; @@ -81,8 +81,9 @@ define([ expandUsedButton, ]; - const parent = this.element[0]; - const ul = this.element.find('ul')[0]; + const parent = this.element[0], + ul = this.element.find('ul')[0]; + this.buttons.forEach(function (button) { button.type = 'button'; parent.insertBefore(button, ul);