Skip to content

Commit

Permalink
Merge pull request #24 from jdev-org/fix-174
Browse files Browse the repository at this point in the history
Corrections mviewer#174
  • Loading branch information
Agath21 authored Mar 27, 2023
2 parents 8448791 + f90d126 commit 715f9b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1695,12 +1695,12 @@ <h5 class="modal-title" i18n="modal.layer.new.searchdata">Ajouter une donnée</h
<div class="modal-body">
<ul class="nav nav-pills mb-4" id="pills-tab-layers" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" data-bs-toggle="pill" data-bs-target="#newlayer-catalog" type="button" role="tab" aria-controls="pills-newlayer-catalog" aria-selected="true">
<a class="nav-link active" data-bs-toggle="pill" data-bs-target="#newlayer-catalog" type="button" role="tab" aria-controls="pills-newlayer-catalog" aria-selected="true" onclick="mv.resetConfLayer(); ">
<span i18n="modal.layer.new.catalog">Depuis un catalogue</span>
</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" data-bs-toggle="pill" data-bs-target="#newlayer-param" type="button" role="tab" aria-controls="pills-newlayer-param" aria-selected="false">
<a class="nav-link" data-bs-toggle="pill" data-bs-target="#newlayer-param" type="button" role="tab" aria-controls="pills-newlayer-param" aria-selected="false" onclick="mv.resetSearch();">
<span i18n="modal.layer.new.param">Via des paramètres</span>
</a>
</li>
Expand Down
28 changes: 18 additions & 10 deletions lib/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ var mv = (function () {
} else {
$("#search-message").text("Aucun résultat pour cette recherche.");
}
},
},

getConfLayers: function () {
// CAS 2 : Ajout d'une couche via ces paramètres
Expand Down Expand Up @@ -411,14 +411,18 @@ var mv = (function () {
.attr("data-layerid", layerid)
.attr("data-title", layername)
.attr("visible", true)
.attr("tiled", true)
.attr("queryable", true)
.find(".layer-name").text(layername);
var layer = {
"id": layerid,
"title": layername,
"name": layername,
"type": layertype,
"url": layerurl,
"visible": true
"visible": true,
"tiled": true,
"queryable": true
};

// Paramètres supplémentaires si Vector-TMS
Expand All @@ -434,14 +438,7 @@ var mv = (function () {
$("#mod-layerNew").modal('hide');
$("#mod-themeOptions").modal('show');

// Reset input
document.getElementById('newlayer-type').value = '';
[...document.querySelectorAll(".param-type")].forEach(e => e.classList.add("d-none"));
[...document.querySelectorAll("#commonParamType >div")].forEach(e => e.classList.add("d-none"));
[...newLayerByParam.querySelectorAll("input")].forEach(function(x){
x.value = "";
x.classList.remove("is-invalid");
});
mv.resetConfLayer();
return
}
// CAS 1 : Ajout d'une couche via un catalogue
Expand Down Expand Up @@ -491,6 +488,17 @@ var mv = (function () {
$("#mod-themeOptions").modal('show');
//remove selection from results
$(".ogc-result input[type='checkbox']:checked").prop("checked", false);
},

resetConfLayer: function () {
// Reset input
document.getElementById('newlayer-type').value = '';
[...document.querySelectorAll(".param-type")].forEach(e => e.classList.add("d-none"));
[...document.querySelectorAll("#commonParamType >div")].forEach(e => e.classList.add("d-none"));
[...newLayerByParam.querySelectorAll("input")].forEach(function(x){
x.value = "";
x.classList.remove("is-invalid");
});
},

resetSearch: function () {
Expand Down

0 comments on commit 715f9b6

Please sign in to comment.