Skip to content

Commit

Permalink
corrections et ajout inputlabel
Browse files Browse the repository at this point in the history
  • Loading branch information
lecault committed Dec 2, 2024
1 parent 8c62a66 commit 5516b48
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -649,19 +649,23 @@ <h2 class="accordion-header" id="accordionSearch">
</div>
</div>
<div class="row my-2 align-items-stretch">
<div class="col-md-6" id="opt-searchl-url" style="display: none;">
<div class="col-md-4" id="opt-searchl-url" style="display: none;">
<label for="opt-searchlocalities-url" i18n="tabs.app.search.address_search.url" class="form-label">URL</label>
<input class="form-control checkedurl" id="opt-searchlocalities-url" type="text" placeholder="Url du service">
</div>
<div class="col-md-6" id="opt-searchl-attribution" style="display: none;">
<div class="col-md-4" id="opt-searchl-attribution" style="display: none;">
<label for="opt-searchlocalities-attribution" i18n="tabs.app.search.address_search.attribution" class="form-label">Attribution</label>
<input class="form-control" id="opt-searchlocalities-attribution" type="text" placeholder="Attribution du service" i18n="tabs.app.search.address_search.attribution.ph">
</div>
<div class="col-md-4 advanced" id="opt-inputlabel" style="display: none;">
<label for="opt-searchlocalities-inputlabel" i18n="tabs.app.search.address_search.inputlabel" class="form-label">Texte écrit dans la zone de saisie</label><span class="tooltip-info" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="tooltip.search.inputlabel"><i class="ri-information-line"></i></span>
<input class="form-control" id="opt-searchlocalities-inputlabel" type="text" placeholder="Rechercher" i18n="tabs.app.search.address_search.inputlabel.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>
<span i18n="tabs.app.search.querymaponclick">Ouverture de la fiche d'information au 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>
Expand Down
13 changes: 9 additions & 4 deletions js/mviewerstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ var newConfiguration = function (infos) {
"opt-togglealllayersfromtheme",
"SwitchCustomBackground",
"SwitchAdvanced",
"search-closeafterclick",
"search-querymaponclick",
].forEach((id) => {
document.querySelector(`#${id}`).checked = false;
});
Expand Down Expand Up @@ -764,13 +766,14 @@ var getConfig = () => {
'url="' + $("#opt-searchlocalities-url").val() + '"',
'attribution="' + $("#opt-searchlocalities-attribution").val() + '" />',
].join(" ");
if ($("#search-querymaponclick").is(":checked")) {
search_params.querymaponclick = true;
if ($("#search-querymaponclick").prop("checked")) {
search_params.querymaponclick = "true";
}
if ($("#search-closeafterclick").is(":checked")) {
search_params.closeafterclick = true;
if ($("#search-closeafterclick").prop("checked")) {
search_params.closeafterclick = "true";
}
search_params.localities = true;
search_params.inputlabel = $("#opt-searchlocalities-inputlabel").val();
}
if (
$("#frm-globalsearch").val() === "elasticsearch" &&
Expand Down Expand Up @@ -805,6 +808,8 @@ var getConfig = () => {
search_params.features +
'" static="' +
search_params.static +
'" inputlabel="' +
search_params.inputlabel +
'" querymaponclick="' +
search_params.querymaponclick +
'" closeafterclick="' +
Expand Down
31 changes: 23 additions & 8 deletions lib/mv.js
Original file line number Diff line number Diff line change
Expand Up @@ -1144,25 +1144,31 @@ var mv = (function () {
case "false":
$("#opt-searchl-url").hide();
$("#opt-searchl-attribution").hide();
$("#opt-searchl-inputlabel").hide();
$("#opt-searchlocalities-url").val("");
$("#opt-searchlocalities-attribution").val("");
$("#opt-searchlocalities-inputlabel").val("");
$("#search-querymaponclick").hide();
$("#search-closeafterclick").hide();
break;
case "ban":
$("#opt-searchl-url").show();
$("#opt-searchl-attribution").show();
$("#opt-searchl-inputlabel").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)");
$("#opt-searchlocalities-inputlabel").val("");
$("#search-querymaponclick").show();
$("#search-closeafterclick").show();
break;
case "custom":
$("#opt-searchlocalities-url").val("");
$("#opt-searchl-url").show();
$("#opt-searchl-attribution").show();
$("#opt-searchl-inputlabel").show();
$("#opt-searchlocalities-url").val("");
$("#opt-searchlocalities-attribution").val("");
$("#opt-searchlocalities-inputlabel").val("");
$("#search-querymaponclick").show();
$("#search-closeafterclick").show();
break;
Expand Down Expand Up @@ -1478,13 +1484,6 @@ 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 All @@ -1507,6 +1506,22 @@ var mv = (function () {
searchparameters.attr("features") === "true"
);
}
if (searchparameters && searchparameters.attr("querymaponclick")) {
$("#search-querymaponclick").prop(
"checked",
searchparameters.attr("querymaponclick") === "true"
);
}
if (searchparameters && searchparameters.attr("closeafterclick")) {
$("#search-closeafterclick").prop(
"checked",
searchparameters.attr("closeafterclick") === "true"
);
}
if (searchparameters && searchparameters.attr("inputlabel")) {
$("#opt-searchlocalities-inputlabel").val(searchparameters.attr("inputlabel"));
}

//Application
var application = $(xml).find("application");

Expand Down
8 changes: 7 additions & 1 deletion mviewerstudio.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@
"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.address_search.inputlabel": "Texte écrit dans la zone de saisie",
"tabs.app.search.address_search.inputlabel.ph": "Rechercher",
"tabs.app.search.querymaponclick": "Ouverture de la fiche d'information au 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.",
Expand Down Expand Up @@ -452,6 +454,7 @@
"tooltip.initial.extent": "Option permettant d'activer le bouton pour revenir à l'étendue intiale de l'application (initialextenttool)",
"tooltip.intern.id": "Identifiant unique et interne au fond de plan",
"tooltip.base.name": "Nom du fond de plan",
"tooltip.search.inputlabel": "Texte à utiliser pour le placeholder de la zone de saisie de la barre de recherche",
"tooltip.webservice.url": "Lien vers le service web",
"tooltip.tec.id.layer": "Identifiant technique de la couche à utiliser",
"tooltip.src.credit": "Sources - Ce paramètre est affiché dans les crédits de la carte",
Expand Down Expand Up @@ -858,6 +861,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.address_search.inputlabel": "Text written in the input field",
"tabs.app.search.address_search.inputlabel.ph": "Search",
"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",
Expand Down Expand Up @@ -948,6 +953,7 @@
"tooltip.initial.extent": "Option to activate the button for returning to the initial scope of the application (initialxtent tool)",
"tooltip.intern.id": "Unique identifier - internal to the base map",
"tooltip.base.name": "Base map name",
"tooltip.search.inputlabel": "Text to be used for the placeholder in the search bar input field",
"tooltip.webservice.url": "Web service URL",
"tooltip.tec.id.layer": "Technical identifier of the layer to be used",
"tooltip.src.credit": "Sources - This parameter is displayed in the card credits",
Expand Down

0 comments on commit 5516b48

Please sign in to comment.