Skip to content

Commit

Permalink
Fixing javascript bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Jul 30, 2024
1 parent 2d2b7de commit fa5b0b4
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 103 deletions.
206 changes: 103 additions & 103 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ else if(BooleanUtils.isTrue(entiteSignature)) {
else {
tl(1, "{%- if \"Page\" == ", langueConfig.getString(I18n.var_classeApiMethodeMethode), " %}");
if("JsonArray".equals(entiteNomSimpleVertxJson) || "JsonObject".equals(entiteNomSimpleVertxJson))
tl(9, "value=\"{{to", entiteNomSimpleVertxJson, "String ", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}\"");
tl(9, "value=\"{{ to", entiteNomSimpleVertxJson, "String(", uncapitalizeClasseNomSimple, "_.", entiteVar, ") }}\"");
else
tl(9, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}\"");
tl(1, "{%- endif %}");
Expand Down Expand Up @@ -1078,7 +1078,7 @@ public void pageCodeClasseJava(String langueNom, JsonObject langueConfig) throws
wJsInit.tl(7, "if(t) {");
wJsInit.tl(8, "var s = t.tz(timeZone).format('YYYY-MM-DDTHH:mm:ss.000') + '[' + timeZone + ']';");
wJsInit.tl(8, "patch", classeNomSimple, "Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: '", classeModele ? classeVarClePrimaire : classeVarCleUnique, ":' + event.currentTarget.getAttribute('data-", classeModele ? classeVarClePrimaire : classeVarCleUnique, "') }]");
wJsInit.tl(10, ", 'set", entiteVarCapitalise, "', s)");
wJsInit.tl(10, ", 'set", entiteVarCapitalise, "', s");
wJsInit.tl(10, ", event.currentTarget");
wJsInit.tl(10, ", function(", langueConfig.getString(I18n.var_reponse), ", target) { ", langueConfig.getString(I18n.var_ajouterLueur), "(target); }");
wJsInit.tl(10, ", function(", langueConfig.getString(I18n.var_reponse), ", target) { ", langueConfig.getString(I18n.var_ajouterErreur), "(target); }");
Expand All @@ -1089,7 +1089,7 @@ public void pageCodeClasseJava(String langueNom, JsonObject langueConfig) throws
wJsInit.tl(7, "if(t) { ");
wJsInit.tl(8, "var s = t.format('HH:mm'); ");
wJsInit.tl(8, "patch{{", langueConfig.getString(I18n.var_classeNomSimple), "}}Val([{ name: 'softCommit', value: 'true' }, { name: 'fq', value: '", classeModele ? classeVarClePrimaire : classeVarCleUnique, ":{{", classeModele ? classeVarClePrimaire : classeVarCleUnique, "}}' }], 'set", entiteVarCapitalise, "', s, this, function() { ", langueConfig.getString(I18n.var_ajouterLueur), "(document.querySelector('.{{", langueConfig.getString(I18n.var_classeApiMethodeMethode), "}}_", entiteVar, "')); }, function() { ", langueConfig.getString(I18n.var_ajouterErreur), "(document.querySelector('.{{", langueConfig.getString(I18n.var_classeApiMethodeMethode), "}}_", entiteVar, "')); }); ");
wJsInit.tl(10, ", 'set", entiteVarCapitalise, "', s)");
wJsInit.tl(10, ", 'set", entiteVarCapitalise, "', s");
wJsInit.tl(10, ", event.currentTarget");
wJsInit.tl(10, ", function(", langueConfig.getString(I18n.var_reponse), ", target) { ", langueConfig.getString(I18n.var_ajouterLueur), "(target); }");
wJsInit.tl(10, ", function(", langueConfig.getString(I18n.var_reponse), ", target) { ", langueConfig.getString(I18n.var_ajouterErreur), "(target); }");
Expand Down Expand Up @@ -2552,6 +2552,103 @@ else if("LocalDate".equals(entiteNomSimple)) {
l();
tl(0, "{%- block htmScript", classePageSuperNomSimple, " %}");
tl(0, "{%- block htmScript", classePageNomSimple, " %}");
tl(2, "<script>");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsWebsocket), classeNomSimple, "(", classeVarClePrimaire == null ? classeVarCleUnique : classeVarClePrimaire, ", vars, $response) {");
tl(4, "{%- block ", i18nPage.getString(I18n.var_jsWebsocket), classePageNomSimple, " %}{%- endblock %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsInfobulle), classeNomSimple, "(e, feature) {");
tl(4, "{%- block ", i18nPage.getString(I18n.var_jsInfobulle), classePageNomSimple, " %}{%- endblock %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_htmInfobulle), classeNomSimple, "(feature, layer) {");
tl(4, "return `{%- block ", i18nPage.getString(I18n.var_htmInfobulle), classePageNomSimple, " %}");
s("<h3>");
if(i18nPage.getString(I18n.var_classeIconeClassesCss) != null)
s("<i class=\"{{ ", i18nPage.getString(I18n.var_classeIconeClassesCss), " }} \"></i>");
s("<a href=\"${quoteattr(feature.properties.pageUrlPk)}\">${feature.properties.objectTitle}</a>");
l("</h3>");
l("{%- endblock ", i18nPage.getString(I18n.var_htmInfobulle), classePageNomSimple, " %}`;");
tl(3, "}");

if(classeVarEmplacement != null) {
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsLegende), classeNomSimple, "(map) {");
tl(0, "{%- block ", i18nPage.getString(I18n.var_jsLegende), classePageNomSimple, " %}");
tl(4, "var div = L.DomUtil.create('div', 'info legend');");
tl(4, "var htm = '';");
tl(4, "window.", i18nPage.getString(I18n.var_liste), classeNomSimple, ".forEach((", StringUtils.uncapitalize(classeNomSimple), ", index) => {");
tl(5, "if(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ") {");
tl(6, "var shapes = [];");
tl(6, "if(Array.isArray(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, "))");
tl(7, "shapes = shapes.concat(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ");");
tl(6, "else");
tl(7, "shapes.push(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ");");
tl(6, "shapes.forEach(function(shape, index) {");
tl(7, "htm += ", i18nPage.getString(I18n.var_htmLegende), classeNomSimple, "(map, shape, ", StringUtils.uncapitalize(classeNomSimple), ", index, shapes.length);");
tl(6, "});");
tl(5, "}");
tl(4, "});");
tl(4, "div.innerHTML = htm;");
tl(4, "return div;");
tl(0, "{%- endblock ", i18nPage.getString(I18n.var_jsLegende), classePageNomSimple, " %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_htmLegende), classeNomSimple, "(map, shape, ", StringUtils.uncapitalize(classeNomSimple), ", index, count) {");
tl(4, "var color = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementCouleur, "[index];");
tl(4, "var title = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementTitre, "[index];");
tl(4, "var url = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementUrl, "[index];");
tl(4, "var htm = '';");
tl(4, "htm += `<div class=\"w3-white w3-padding w3-border w3-opacity w3-hover-opacity-off cursor-pointer \" style=\"max-width: 400px; \">");
tl(0, "`;");
t(4, "htm += `");
l("{%- block ", i18nPage.getString(I18n.var_htmLegende), classePageNomSimple, " %}");
tl(2, "<div class=\"w3-row \" title=\"${quoteattr(title)}\">");
tl(2, "<div class=\"w3-col \" style=\"width: 20px; \">");
tl(3, "<i class=\"fa-light fa-circle\" style=\"color: ${color}; \"></i>");
tl(2, "</div>");
tl(2, "<div class=\"w3-rest text-overflow-ellipsis \">");
tl(3, "<span class=\"\" data-", classeVarCleUnique, "=\"${", uncapitalizeClasseApiClasseNomSimple, ".", classeVarCleUnique, "}\" onclick=\"window.mapLayers[this.getAttribute('data-", classeVarCleUnique, "')].openPopup(); return false;\" href=\"\">${title}</span>");
tl(2, "</div>");
tl(2, "</div>");
l("{%- endblock ", i18nPage.getString(I18n.var_htmLegende), classePageNomSimple, " %}`;");
tl(4, "htm += `");
tl(0, "</div>");
tl(0, "`;");
tl(4, "return htm;");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsStyle), classeNomSimple, "(feature) {");
tl(0, "{%- block ", i18nPage.getString(I18n.var_jsStyle), classePageNomSimple, " %}");
tl(4, "if(feature.geometry.type == 'Point') {");
tl(5, "return {");
tl(6, "radius: 8");
tl(6, ", fillColor: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 1");
tl(6, ", opacity: 0.7");
tl(6, ", fillOpacity: 0.7");
tl(5, "};");
tl(4, "} else if(feature.geometry.type == 'LineString') {");
tl(5, "return {");
tl(6, "color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 5");
tl(6, ", opacity: 0.7");
tl(5, "};");
tl(4, "} else {");
tl(5, "return {");
tl(6, " fillColor: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 3");
tl(6, ", opacity: 0.7");
tl(6, ", fillOpacity: 0.7");
tl(5, "};");
tl(4, "}");
tl(0, "{%- endblock ", i18nPage.getString(I18n.var_jsStyle), classePageNomSimple, " %}");
tl(3, "}");
}
tl(2, "</script>");
tl(2, "<script type=\"module\">");
for(String classeApiMethode : classeApiMethodes) {
String classeApiOperationIdMethode = classeDoc.getString("classeApiOperationId" + classeApiMethode + "_" + langueNom + "_stored_string");
Expand Down Expand Up @@ -3021,15 +3118,15 @@ else if(entiteAttribuer) {
tl(4, "var pk = {% if pk is defined %}{{pk}}{% else %}null{% endif %};");
l();
tl(4, "if(pk == null) {");
tl(5, "document.querySelector('#grid-toggle-details').addEventListener('click', () => {");
tl(5, "document.querySelector('#grid-toggle-details')?.addEventListener('click', () => {");
tl(6, "document.querySelector('#site-results-grid').classList.remove('grid-mode-list', 'grid-mode-card');");
tl(6, "document.querySelector('#site-results-grid').classList.add('grid-mode-details');");
tl(5, "});");
tl(5, "document.querySelector('#grid-toggle-list').addEventListener('click', () => {");
tl(5, "document.querySelector('#grid-toggle-list')?.addEventListener('click', () => {");
tl(6, "document.querySelector('#site-results-grid').classList.remove('grid-mode-details', 'grid-mode-card');");
tl(6, "document.querySelector('#site-results-grid').classList.add('grid-mode-list');");
tl(5, "});");
tl(5, "document.querySelector('#grid-toggle-card').addEventListener('click', () => {");
tl(5, "document.querySelector('#grid-toggle-card')?.addEventListener('click', () => {");
tl(6, "document.querySelector('#site-results-grid').classList.remove('grid-mode-details', 'grid-mode-list');");
tl(6, "document.querySelector('#site-results-grid').classList.add('grid-mode-card');");
tl(5, "});");
Expand Down Expand Up @@ -3077,103 +3174,6 @@ else if(i18nPage.getString(I18n.var_PUTCopie).equals(classeApiMethode))
}
tl(3, "});");
tl(2, "</script>");
tl(2, "<script>");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsWebsocket), classeNomSimple, "(", classeVarClePrimaire == null ? classeVarCleUnique : classeVarClePrimaire, ", vars, $response) {");
tl(4, "{%- block ", i18nPage.getString(I18n.var_jsWebsocket), classePageNomSimple, " %}{%- endblock %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsInfobulle), classeNomSimple, "(e, feature) {");
tl(4, "{%- block ", i18nPage.getString(I18n.var_jsInfobulle), classePageNomSimple, " %}{%- endblock %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_htmInfobulle), classeNomSimple, "(feature, layer) {");
tl(4, "return `{%- block ", i18nPage.getString(I18n.var_htmInfobulle), classePageNomSimple, " %}");
s("<h3>");
if(i18nPage.getString(I18n.var_classeIconeClassesCss) != null)
s("<i class=\"{{ ", i18nPage.getString(I18n.var_classeIconeClassesCss), " }} \"></i>");
s("<a href=\"${quoteattr(feature.properties.pageUrlPk)}\">${feature.properties.objectTitle}</a>");
l("</h3>");
l("{%- endblock ", i18nPage.getString(I18n.var_htmInfobulle), classePageNomSimple, " %}`;");
tl(3, "}");

if(classeVarEmplacement != null) {
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsLegende), classeNomSimple, "(map) {");
tl(0, "{%- block ", i18nPage.getString(I18n.var_jsLegende), classePageNomSimple, " %}");
tl(4, "var div = L.DomUtil.create('div', 'info legend');");
tl(4, "var htm = '';");
tl(4, "window.", i18nPage.getString(I18n.var_liste), classeNomSimple, ".forEach((", StringUtils.uncapitalize(classeNomSimple), ", index) => {");
tl(5, "if(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ") {");
tl(6, "var shapes = [];");
tl(6, "if(Array.isArray(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, "))");
tl(7, "shapes = shapes.concat(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ");");
tl(6, "else");
tl(7, "shapes.push(", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacement, ");");
tl(6, "shapes.forEach(function(shape, index) {");
tl(7, "htm += ", i18nPage.getString(I18n.var_htmLegende), classeNomSimple, "(map, shape, ", StringUtils.uncapitalize(classeNomSimple), ", index, shapes.length);");
tl(6, "});");
tl(5, "}");
tl(4, "});");
tl(4, "div.innerHTML = htm;");
tl(4, "return div;");
tl(0, "{%- endblock ", i18nPage.getString(I18n.var_jsLegende), classePageNomSimple, " %}");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_htmLegende), classeNomSimple, "(map, shape, ", StringUtils.uncapitalize(classeNomSimple), ", index, count) {");
tl(4, "var color = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementCouleur, "[index];");
tl(4, "var title = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementTitre, "[index];");
tl(4, "var url = ", StringUtils.uncapitalize(classeNomSimple), ".", classeVarEmplacementUrl, "[index];");
tl(4, "var htm = '';");
tl(4, "htm += `<div class=\"w3-white w3-padding w3-border w3-opacity w3-hover-opacity-off cursor-pointer \" style=\"max-width: 400px; \">");
tl(0, "`;");
t(4, "htm += `");
l("{%- block ", i18nPage.getString(I18n.var_htmLegende), classePageNomSimple, " %}");
tl(2, "<div class=\"w3-row \" title=\"${quoteattr(title)}\">");
tl(2, "<div class=\"w3-col \" style=\"width: 20px; \">");
tl(3, "<i class=\"fa-light fa-circle\" style=\"color: ${color}; \"></i>");
tl(2, "</div>");
tl(2, "<div class=\"w3-rest text-overflow-ellipsis \">");
tl(3, "<span class=\"\" data-", classeVarCleUnique, "=\"${", uncapitalizeClasseApiClasseNomSimple, ".", classeVarCleUnique, "}\" onclick=\"window.mapLayers[this.getAttribute('data-", classeVarCleUnique, "')].openPopup(); return false;\" href=\"\">${title}</span>");
tl(2, "</div>");
tl(2, "</div>");
l("{%- endblock ", i18nPage.getString(I18n.var_htmLegende), classePageNomSimple, " %}`;");
tl(4, "htm += `");
tl(0, "</div>");
tl(0, "`;");
tl(4, "return htm;");
tl(3, "}");
l();
tl(3, "function ", i18nPage.getString(I18n.var_jsStyle), classeNomSimple, "(feature) {");
tl(0, "{%- block ", i18nPage.getString(I18n.var_jsStyle), classePageNomSimple, " %}");
tl(4, "if(feature.geometry.type == 'Point') {");
tl(5, "return {");
tl(6, "radius: 8");
tl(6, ", fillColor: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 1");
tl(6, ", opacity: 0.7");
tl(6, ", fillOpacity: 0.7");
tl(5, "};");
tl(4, "} else if(feature.geometry.type == 'LineString') {");
tl(5, "return {");
tl(6, "color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 5");
tl(6, ", opacity: 0.7");
tl(5, "};");
tl(4, "} else {");
tl(5, "return {");
tl(6, " fillColor: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", color: (feature.properties.areaServedColors && feature.properties.areaServedColors[feature.index] ? feature.properties.areaServedColors[feature.index] : (feature.properties.color ? feature.properties.color : '#000'))");
tl(6, ", weight: 3");
tl(6, ", opacity: 0.7");
tl(6, ", fillOpacity: 0.7");
tl(5, "};");
tl(4, "}");
tl(0, "{%- endblock ", i18nPage.getString(I18n.var_jsStyle), classePageNomSimple, " %}");
tl(3, "}");
}
tl(2, "</script>");
tl(0, "{%- endblock htmScript", classePageNomSimple, " %}");
tl(0, "{%- endblock htmScript", classePageSuperNomSimple, " %}");

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/computate/frFR/java/IndexerClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -5553,6 +5553,9 @@ else if("location".equals(fieldName))
wSmartDataModel.l(" * Description: ", description.replace("\r\n", " ").replace("\n", " "), "");
wSmartDataModel.l(" * HtmRow: ", row, "");
wSmartDataModel.l(" * HtmCell: ", cell, "");
if("name".equals(fieldName)) {
wSmartDataModel.l(" * HtmColumn: 1");
}
wSmartDataModel.l(" * Facet: true");
wSmartDataModel.l(" **/");
wSmartDataModel.l(" protected void _", fieldName, "(Wrap<", javaType, "> w) {}");
Expand Down

0 comments on commit fa5b0b4

Please sign in to comment.