Commit 4bdca206 authored by igoshin's avatar igoshin Committed by Matija Obreza

#13466 enabled layers managing

parent 863a4da5
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
<ul class="nav nav-pills "> <ul class="nav nav-pills ">
<li class="active dropdown form-horizontal pull-right" id="get-filters"> <li class="active dropdown form-horizontal pull-right" >
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><spring:message code="filters.saved"/></a> <a id="get-filters" href="#"><spring:message code="filters.saved"/></a>
<ul class="dropdown-menu"></ul> <ul id="enabled-filters" class="dropdown-menu"></ul>
</li> </li>
...@@ -119,12 +119,13 @@ ...@@ -119,12 +119,13 @@
success: function (data) { success: function (data) {
$.each(data, function (idx, filter) { $.each(data, function (idx, filter) {
var li = "<li><a href='#' class='saved-filter' fil='"+filter.filter+"'>" + filter.title + "</a></li>"; // var li = "<li><a href='#' class='saved-filter' fil='"+filter.filter+"'>" + filter.title + "</a></li>";
var li = "<li><label class='saved-filter' fil='"+filter.filter+"'><input style='margin-right: 10px;margin-left: 5px' type='checkbox'>" + filter.title + "</label></li>";
if ($(".dropdown-menu").is(":visible")) { if ($("#enabled-filters").is(":visible")) {
$(".dropdown-menu").append(li); $("#enabled-filters").append(li);
} else { } else {
$(".dropdown-menu").empty(); $("#enabled-filters").empty();
} }
}); });
}, },
...@@ -132,6 +133,7 @@ ...@@ -132,6 +133,7 @@
console.log(error) console.log(error)
} }
}); });
$("#enabled-filters").toggle();
}); });
var globalTitle=""; var globalTitle="";
...@@ -148,18 +150,25 @@ ...@@ -148,18 +150,25 @@
subdomains: [${props.tileserverCdn}] subdomains: [${props.tileserverCdn}]
}).addTo(map); }).addTo(map);
$("#selectArea").hide(); $("#selectArea").hide();
var filterJson=${jsonFilter}; var filterJson =${jsonFilter};
var layer;
$("body").on("click", ".saved-filter", function () {
var title = $(this).text();
var filter = $(this).attr("fil");
globalTitle = title;
if ($(this).find("input:checkbox").is(":checked")) {
layer = L.tileLayer("{s}/explore/tile/{z}/{x}/{y}?filter=" + filter + "&title=" + title, {
attribution: "<a href='${props.baseUrl}'>Genesys</a>",
styleId: 22677,
subdomains: [${props.tileserverCdn}]
}).addTo(map);
} else {
map.removeLayer(layer);
}
$("body").on("click",".saved-filter",function(){
var title=$(this).text();
var filter=$(this).attr("fil");
globalTitle=title;
L.tileLayer("{s}/explore/tile/{z}/{x}/{y}?filter=" + filter+"&title="+title, {
attribution: "<a href='${props.baseUrl}'>Genesys</a>",
styleId: 22677,
subdomains: [${props.tileserverCdn}]
}).addTo(map);
}); });
var locationFilter = new L.LocationFilter({adjustButton: false, bounds: map.getBounds().pad(-0.1) }).addTo(map); var locationFilter = new L.LocationFilter({adjustButton: false, bounds: map.getBounds().pad(-0.1) }).addTo(map);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment