X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmenu_ui%2Fmenu_ui.admin.es6.js;fp=web%2Fcore%2Fmodules%2Fmenu_ui%2Fmenu_ui.admin.es6.js;h=3c824f54833d85db0cfbe1946c8255fedfd4eda8;hp=3144d13dc1b33788ae60aefdf1df786fa55fb794;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/menu_ui/menu_ui.admin.es6.js b/web/core/modules/menu_ui/menu_ui.admin.es6.js index 3144d13dc..3c824f548 100644 --- a/web/core/modules/menu_ui/menu_ui.admin.es6.js +++ b/web/core/modules/menu_ui/menu_ui.admin.es6.js @@ -3,7 +3,7 @@ * Menu UI admin behaviors. */ -(function ($, Drupal) { +(function($, Drupal) { /** * * @type {Drupal~behavior} @@ -25,17 +25,19 @@ /** * Function to set the options of the menu parent item dropdown. */ - Drupal.menuUiUpdateParentList = function () { + Drupal.menuUiUpdateParentList = function() { const $menu = $('#edit-menu'); const values = []; - $menu.find('input:checked').each(function () { + $menu.find('input:checked').each(function() { // Get the names of all checked menus. values.push(Drupal.checkPlain($.trim($(this).val()))); }); $.ajax({ - url: `${location.protocol}//${location.host}${Drupal.url('admin/structure/menu/parents')}`, + url: `${window.location.protocol}//${window.location.host}${Drupal.url( + 'admin/structure/menu/parents', + )}`, type: 'POST', data: { 'menus[]': values }, dataType: 'json', @@ -47,16 +49,25 @@ $select.children().remove(); // Add new options to dropdown. Keep a count of options for testing later. let totalOptions = 0; - Object.keys(options || {}).forEach((machineName) => { + Object.keys(options || {}).forEach(machineName => { $select.append( - $(``).val(machineName).text(options[machineName]), + $( + ``, + ) + .val(machineName) + .text(options[machineName]), ); totalOptions++; }); // Hide the parent options if there are no options for it. - $select.closest('div').toggle(totalOptions > 0).attr('hidden', totalOptions === 0); + $select + .closest('div') + .toggle(totalOptions > 0) + .attr('hidden', totalOptions === 0); }, }); }; -}(jQuery, Drupal)); +})(jQuery, Drupal);