Skip to content

Commit

Permalink
ajout options adresse
Browse files Browse the repository at this point in the history
  • Loading branch information
lecault committed Nov 29, 2024
1 parent a97dbbe commit 8537d6a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,26 @@ <h2 class="accordion-header" id="accordionSearch">
<input class="form-control" id="opt-searchlocalities-attribution" type="text" placeholder="Attribution du service" i18n="tabs.app.search.address_search.attribution.ph">
</div>
</div>
<ul class="list-group">
<li class="list-group-item advanced" style="display: none;">
<div class="list-flex">
<span i18n="tabs.app.search.querymaponclick">Interrogation de la carte après clic</span>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="checkboxes" id="search-querymaponclick">
<label class="custom-control-label" for="search-querymaponclick"></label>
</div>
</div>
</li>
<li class="list-group-item advanced" style="display: none;">
<div class="list-flex">
<span i18n="tabs.app.search.closeafterclick">Ferme la liste de résultat après clic</span>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="checkboxes" id="search-closeafterclick">
<label class="custom-control-label" for="search-closeafterclick"></label>
</div>
</div>
</li>
</ul>
</div>
</li>
<li class="list-group-item advanced" style="display: none;">
Expand Down
12 changes: 11 additions & 1 deletion js/mviewerstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,13 +750,19 @@ var getConfig = () => {
if ($("#optProxyUrl").val() && _conf.proxy) {
savedProxy = `${padding(0)}<proxy url="${$("#optProxyUrl").val() || _conf.proxy}"/>`;
}
var search_params = { bbox: false, localities: false, features: false, static: false };
var search_params = { bbox: false, localities: false, features: false, static: false, querymaponclick:false, closeafterclick:false };
if ($("#SwitchAdressSearch").is(":checked")) {
olscompletion = [
padding(0) + '<olscompletion type="' + $("#frm-searchlocalities").val() + '"',
'url="' + $("#opt-searchlocalities-url").val() + '"',
'attribution="' + $("#opt-searchlocalities-attribution").val() + '" />',
].join(" ");
if ($("#search-querymaponclick").is(":checked")) {
search_params.querymaponclick = true;
}
if ($("#search-closeafterclick").is(":checked")) {
search_params.closeafterclick = true;
}
search_params.localities = true;
}
if (
Expand Down Expand Up @@ -792,6 +798,10 @@ var getConfig = () => {
search_params.features +
'" static="' +
search_params.static +
'" querymaponclick="' +
search_params.querymaponclick +
'" closeafterclick="' +
search_params.closeafterclick +
'"/>';

var maxextentStr = "";
Expand Down
13 changes: 13 additions & 0 deletions lib/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,19 +1146,25 @@ var mv = (function () {
$("#opt-searchl-attribution").hide();
$("#opt-searchlocalities-url").val("");
$("#opt-searchlocalities-attribution").val("");
$("#search-querymaponclick").hide();
$("#search-closeafterclick").hide();
break;
case "ban":
$("#opt-searchl-url").show();
$("#opt-searchl-attribution").show();
// TODO : need to get values from config
$("#opt-searchlocalities-url").val("https://api-adresse.data.gouv.fr/search/");
$("#opt-searchlocalities-attribution").val("Base adresse nationale (BAN)");
$("#search-querymaponclick").show();
$("#search-closeafterclick").show();
break;
case "custom":
$("#opt-searchlocalities-url").val("");
$("#opt-searchl-url").show();
$("#opt-searchl-attribution").show();
$("#opt-searchlocalities-attribution").val("");
$("#search-querymaponclick").show();
$("#search-closeafterclick").show();
break;
}
},
Expand Down Expand Up @@ -1472,6 +1478,13 @@ var mv = (function () {
if (olscompletion && olscompletion.attr("attribution")) {
$("#opt-searchlocalities-attribution").val(olscompletion.attr("attribution"));
}
if (olscompletion && olscompletion.attr("querymaponclick")) {
$("#search-querymaponclick").val(olscompletion.attr("querymaponclick"));
}
if (olscompletion && olscompletion.attr("closeafterclick")) {
$("#search-closeafterclick").val(olscompletion.attr("closeafterclick"));
}

var elasticsearch = $(xml).find("elasticsearch");
if (elasticsearch && elasticsearch.attr("url")) {
$("#frm-globalsearch").val("elasticsearch").trigger("change");
Expand Down
4 changes: 4 additions & 0 deletions mviewerstudio.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
"tabs.app.search.address_search.url": "URL",
"tabs.app.search.address_search.attribution": "Attribution",
"tabs.app.search.address_search.attribution.ph": "Attribution du service",
"tabs.app.search.querymaponclick": "Interrogation de la carte après clic",
"tabs.app.search.closeafterclick": "Ferme la liste de résultat après clic",
"tabs.adv.title": "Fonctionnalités avancées",
"tabs.adv.alert": "Le paramétrage de cette section est optionnel.",
"tabs.versions.title": "Gérer les version de la carte",
Expand Down Expand Up @@ -856,6 +858,8 @@
"tabs.app.search.address_search.url": "URL",
"tabs.app.search.address_search.attribution": "Attribution",
"tabs.app.search.address_search.attribution.ph": "Service attribution",
"tabs.app.search.querymaponclick": "Querying the map after clicking",
"tabs.app.search.closeafterclick": "Closes the result list after clicking",
"tabs.data.themespanel.subtitle": "Create, import and manage themes and data",
"tabs.adv.title": "Advanced features",
"tabs.adv.alert": "These parameters are optional",
Expand Down

0 comments on commit 8537d6a

Please sign in to comment.