mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
"Add All Zones" button
This adds a "Add All Zones" button to the multiple zones selector used for RenderWithZones. This addresses the Issue # 775
This commit is contained in:
parent
005869f414
commit
43bf840b94
1 changed files with 23 additions and 1 deletions
|
@ -3722,6 +3722,25 @@ function addZoneToZonesSelection(propertyId, id) {
|
|||
document.getElementById("zones-select-selector-list-panel-" + propertyId).style.display = "none";
|
||||
}
|
||||
|
||||
function addAllZonesToZonesSelection (propertyId) {
|
||||
let hiddenField = document.getElementById(propertyId);
|
||||
if (JSON.stringify(hiddenField.value) === '"undefined"') {
|
||||
hiddenField.value = "[]";
|
||||
}
|
||||
let selectedZones = JSON.parse(hiddenField.value);
|
||||
let i;
|
||||
for (i = 0; i < zonesList.length; i++) {
|
||||
if (!selectedZones.includes(zonesList[i].id)) {
|
||||
selectedZones.push(zonesList[i].id);
|
||||
}
|
||||
}
|
||||
hiddenField.value = JSON.stringify(selectedZones);
|
||||
displaySelectedZones(propertyId, true);
|
||||
let propertyName = propertyId.replace("property-", "");
|
||||
updateProperty(propertyName, selectedZones, false);
|
||||
document.getElementById("zones-select-selector-list-panel-" + propertyId).style.display = "none";
|
||||
}
|
||||
|
||||
function removeZoneFromZonesSelection(propertyId, zoneId) {
|
||||
let hiddenField = document.getElementById(propertyId);
|
||||
if (JSON.stringify(hiddenField.value) === '"undefined"') {
|
||||
|
@ -3813,7 +3832,10 @@ function setZonesSelectionData(element, isEditable) {
|
|||
zoneSelector += "<input type='button' value = 'Add a Zone' id='zones-select-add-" + element.id + "' onClick='document.getElementById(";
|
||||
zoneSelector += '"' + "zones-select-selector-list-panel-" + element.id + '"' + ").style.display = " + '"' + "block" + '"' + ";'>";
|
||||
zoneSelector += "<div class = 'zoneSelectorListPanel' id='zones-select-selector-list-panel-" + element.id + "'>";
|
||||
zoneSelector += "<div class='zoneSelectListHeader'>Select the Zone to add: </div>";
|
||||
zoneSelector += "<div class='zoneSelectListHeader'>Select the Zone to add:";
|
||||
zoneSelector += "<input type='button' id='zones-select-add-all-" + element.id + "' class='blue forceAlignRight' value = 'Add All Zones'";
|
||||
zoneSelector += "onClick='addAllZonesToZonesSelection(" + '"' + element.id + '"' + ");'>";
|
||||
zoneSelector += "</div>";
|
||||
zoneSelector += "<div class='zoneSelectList' id = 'zones-select-selector-list-" + element.id + "'>";
|
||||
let i, name;
|
||||
for (i = 0; i < zonesList.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue