Issue #1829328 by Christian Biggins, larowlan | falcon03: Fixed Adding a new content type, 'default parent item' is shown even if no menu is selected.

8.0.x
Alex Pott 2013-04-11 08:51:49 +01:00
parent 3e3f16e8e7
commit 7ba4db06c8
1 changed files with 6 additions and 1 deletions

View File

@ -32,14 +32,19 @@ Drupal.menuUpdateParentList = function () {
var selected = $select.val();
// Remove all exisiting options from dropdown.
$select.children().remove();
// Add new options to dropdown.
// Add new options to dropdown. Keep a count of options for testing later.
var totalOptions = 0;
for (var machineName in options) {
if (options.hasOwnProperty(machineName)) {
$select.append(
$('<option ' + (machineName === selected ? ' selected="selected"' : '') + '></option>').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);
}
});
};