dialog for types on a button

New button for the zone Types dialog.
This commit is contained in:
Ángel Montero Lamas 2022-01-22 15:21:43 +01:00
parent d3e845413f
commit a49376480d
2 changed files with 7 additions and 5 deletions

View file

@ -2916,7 +2916,7 @@
<div id="zonesFilters"> <div id="zonesFilters">
<span>Filter by type: </span> <span>Filter by type: </span>
<select id="zonesFilterType" data-tip="Only zones of this type appear on the map"></select> <select id="zonesFilterType" data-tip="Only zones of this type appear on the map"></select>
<button id="zonesFilterButton" data-tip="Click to toggle the filtering of elements on the list" class="icon-eye"></button> <button id="zonesFilterButton" data-tip="Click to toggle the filtering of elements on the list" class="icon-resize-small"></button>
</div> </div>
<div id="zonesFooter" class="totalLine"> <div id="zonesFooter" class="totalLine">
@ -2944,6 +2944,7 @@
</div> </div>
<button id="zonesAdd" data-tip="Add new zone layers or types" class="icon-plus"></button> <button id="zonesAdd" data-tip="Add new zone layers or types" class="icon-plus"></button>
<button id="zonesEditTypes" data-tip="Add and edit zone types" class="icon-edit"></button>
<button id="zonesExport" data-tip="Download zones-related data" class="icon-download"></button> <button id="zonesExport" data-tip="Download zones-related data" class="icon-download"></button>
</div> </div>
</div> </div>
@ -2961,7 +2962,6 @@
</div> </div>
<div id="zonesTypesBottom"> <div id="zonesTypesBottom">
<button id="zonesNewBlank" data-tip="Add a new blank zone layer" class="icon-flag-empty"></button>
<input type="text" id="zonesNewTypeInput" data-tip="Write the name of the type you want to add" maxlength="20" placeholder="Add type"></input> <input type="text" id="zonesNewTypeInput" data-tip="Write the name of the type you want to add" maxlength="20" placeholder="Add type"></input>
<input type="button" id="zonesNewTypeButton" data-tip="Click add to save the type" value="Add"> <input type="button" id="zonesNewTypeButton" data-tip="Click add to save the type" value="Add">
</div> </div>

View file

@ -27,8 +27,8 @@ function editZones() {
document.getElementById("zonesManually").addEventListener("click", enterZonesManualAssignent); document.getElementById("zonesManually").addEventListener("click", enterZonesManualAssignent);
document.getElementById("zonesManuallyApply").addEventListener("click", applyZonesManualAssignent); document.getElementById("zonesManuallyApply").addEventListener("click", applyZonesManualAssignent);
document.getElementById("zonesManuallyCancel").addEventListener("click", cancelZonesManualAssignent); document.getElementById("zonesManuallyCancel").addEventListener("click", cancelZonesManualAssignent);
document.getElementById("zonesAdd").addEventListener("click", addZonesDialog); document.getElementById("zonesAdd").addEventListener("click", addZonesLayer);
document.getElementById("zonesNewBlank").addEventListener("click", addZonesLayer); document.getElementById("zonesEditTypes").addEventListener("click", addZonesDialog);
document.getElementById("zonesNewTypeButton").addEventListener("click", addZonesType); document.getElementById("zonesNewTypeButton").addEventListener("click", addZonesType);
document.getElementById("zonesExport").addEventListener("click", downloadZonesData); document.getElementById("zonesExport").addEventListener("click", downloadZonesData);
document.getElementById("zonesRemove").addEventListener("click", toggleEraseMode); document.getElementById("zonesRemove").addEventListener("click", toggleEraseMode);
@ -149,6 +149,8 @@ function editZones() {
}); });
body.innerHTML = lines; body.innerHTML = lines;
if (body.innerHTML === "") { body.innerHTML = `<div class="states"><span>Zero entries for this type. To see entries again, select "All" or disable the filter button</span>
</div>`; }
for (let i=0; i<zoneCount; i++) { for (let i=0; i<zoneCount; i++) {
let d = document.getElementById("zoneTypeZoneIdzone" + i); let d = document.getElementById("zoneTypeZoneIdzone" + i);
@ -536,7 +538,7 @@ function editZones() {
let count=0; // Amount of zones per type let count=0; // Amount of zones per type
zones.selectAll("g").each(function() { if (this.dataset.type === z) count++; }); zones.selectAll("g").each(function() { if (this.dataset.type === z) count++; });
lines += `<div class="states"><span class="religionDeity">${z}</span><span class="religionType">${count}</span>`; lines += `<div class="states"><span class="religionDeity">${z}</span><span class="statePopulation">${count}</span>`;
if (i > 5) { if (i > 5) {
let id="removeZoneType" + i; let id="removeZoneType" + i;
lines += `<span data-tip="Remove zone type" class="icon-trash-empty" id="${id}"></span>`; lines += `<span data-tip="Remove zone type" class="icon-trash-empty" id="${id}"></span>`;