Skip to content

Commit

Permalink
Moving jsWebsocket, jsTooltip, and htmTooltips to page templates
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Nov 17, 2023
1 parent fec6798 commit 982eb1e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/computate/frFR/java/ConfigCles.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ public class ConfigCles {
public static final String var_initLoin = "var_initLoin";
public static final String var_InitLoin = "var_InitLoin";
public static final String var_Interne = "var_Interne";
public static final String var_jsInfobulle = "var_jsInfobulle";
public static final String var_JsInfobulle = "var_JsInfobulle";
public static final String var_jsWebsocket = "var_jsWebsocket";
public static final String var_JsWebsocket = "var_JsWebsocket";
public static final String var_LANGUE_NOM = "var_LANGUE_NOM";
public static final String var_Langue = "var_Langue";
public static final String var_Largeur = "var_Largeur";
Expand Down
31 changes: 20 additions & 11 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1333,10 +1333,7 @@ public void pageCodeClasseJava(String langueNom, YAMLConfiguration langueConfig)
wWebsocket.s(wWebsocketInput1);
wWebsocket.l();
wWebsocket.s(wWebsocketInput2);
if(classeJsWebsocket != null) {
wWebsocket.l();
wWebsocket.l(classeJsWebsocket);
}
wWebsocket.tl(4, langueConfig.getString(ConfigCles.var_jsWebsocket), classeNomSimple, "(vars, $response);");
wWebsocket.l();
wWebsocket.tl(4, "window.", StringUtils.uncapitalize(classeNomSimple), " = JSON.parse($response.find('.", langueConfig.getString(ConfigCles.var_page), langueConfig.getString(ConfigCles.var_Formulaire), " .", StringUtils.uncapitalize(classeNomSimple), "').val());");
wWebsocket.l();
Expand Down Expand Up @@ -2562,6 +2559,9 @@ else if("LocalDate".equals(entiteNomSimple)) {
l("{{#partial \"htmScripts\"}}{{> htmScripts", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"htmScript\"}}{{> htmScript", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"websocket\"}}{{> websocket", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"", langueConfig.getString(ConfigCles.var_jsWebsocket), "\"}}{{> ", langueConfig.getString(ConfigCles.var_jsWebsocket), classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"", langueConfig.getString(ConfigCles.var_jsInfobulle), "\"}}{{> ", langueConfig.getString(ConfigCles.var_jsInfobulle), "", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"", langueConfig.getString(ConfigCles.var_htmInfobulle), "\"}}{{> ", langueConfig.getString(ConfigCles.var_htmInfobulle), "", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"htmBodySidebar\"}}{{> htmBodySidebar", classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"htmBody", langueConfig.getString(ConfigCles.var_Debut), "\"}}{{> htmBody", langueConfig.getString(ConfigCles.var_Debut), classePageNomSimple, "}}{{/partial}}");
l("{{#partial \"htmBody", langueConfig.getString(ConfigCles.var_Milieu), "\"}}{{> htmBody", langueConfig.getString(ConfigCles.var_Milieu), classePageNomSimple, "}}{{/partial}}");
Expand Down Expand Up @@ -3175,13 +3175,26 @@ else if(entiteAttribuer) {
tl(4, "//calendar.render();");
tl(0, "{{#block \"websocket\"}}{{/block}}");
tl(3, "});");
l();
tl(3, "function ", langueConfig.getString(ConfigCles.var_jsWebsocket), classeNomSimple, "(vars, $response) {");
tl(0, "{{#block \"", langueConfig.getString(ConfigCles.var_jsWebsocket), "\"}}{{/block}}");
tl(3, "}");
l();
tl(3, "function ", langueConfig.getString(ConfigCles.var_jsInfobulle), classeNomSimple, "(e, feature) {");
tl(0, "{{#block \"", langueConfig.getString(ConfigCles.var_jsInfobulle), "\"}}{{/block}}");
tl(3, "}");
l();
tl(3, "function ", langueConfig.getString(ConfigCles.var_htmInfobulle), classeNomSimple, "(feature, layer) {");
tl(4, "return `{{#block \"", langueConfig.getString(ConfigCles.var_htmInfobulle), "\"}}{{/block}}`;");
tl(3, "}");
tl(2, "</script>");
tl(0, "{{/inline}}");

tl(0, "{{#*inline \"websocket", classePageNomSimple, "\"}}");
tl(4, "<!-- inline \"websocket", classePageNomSimple, "\" -->");
tl(4, "websocket", classeApiClasseNomSimple, "(websocket", classeApiClasseNomSimple, "Inner);");
tl(0, "{{/inline}}");
tl(0, "{{#*inline \"websocket", classePageNomSimple, "\"}}{{/inline}}");
}
t(0, "{{#*inline \"htmUrl", classeApiClasseNomSimple, "\"}}");
s("{{pageUri}}");
Expand Down Expand Up @@ -4787,20 +4800,16 @@ else if(langueConfig.getString(ConfigCles.var_PUTCopie).equals(classeApiMethode)
// auteurPageJs.tl(5, "});");
auteurPageJs.tl(4, "});");
auteurPageJs.tl(4, "function onEachFeature(feature, layer) {");
if(classeHtmInfobulle != null) {
auteurPageJs.tl(5, "let popupContent = `", classeHtmInfobulle, "`;");
auteurPageJs.tl(5, "layer.bindPopup(popupContent);");
}
auteurPageJs.tl(5, "let popupContent = ", langueConfig.getString(ConfigCles.var_htmInfobulle), classeNomSimple, "(feature, layer);");
auteurPageJs.tl(5, "layer.bindPopup(popupContent);");
auteurPageJs.tl(4, "}");
auteurPageJs.tl(4, "var geojsonLayer = L.geoJSON(features, {onEachFeature}).addTo(map);");
// auteurPageJs.tl(4, "}");
auteurPageJs.tl(3, "}");
auteurPageJs.tl(2, "});");
auteurPageJs.tl(2, "map.on('popupopen', function(e) {");
auteurPageJs.tl(3, "var feature = e.popup._source.feature;");
if(classeJsInfobulle != null) {
auteurPageJs.l(classeJsInfobulle);
}
auteurPageJs.tl(3, langueConfig.getString(ConfigCles.var_jsInfobulle), classeNomSimple, "(e, feature);");
auteurPageJs.tl(2, "});");
// auteurPageJs.tl(2, "Plotly.react(, data, layout);");
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/org/computate/i18n/i18n_enUS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,10 @@ var_InheritClePrimaire: "InheritPrimaryKey"
var_initLoin: "initDeep"
var_InitLoin: "InitDeep"
var_Interne: "Internal"
var_jsInfobulle: "jsTooltip"
var_JsInfobulle: "JsTooltip"
var_jsWebsocket: "jsWebsocket"
var_JsWebsocket: "JsWebsocket"
var_Langue: "Language"
var_Largeur: "Width"
var_LeNomAdjectif: "TheNameAdjective"
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/org/computate/i18n/i18n_frFR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ var_InheritClePrimaire: "InheritClePrimaire"
var_initLoin: "initLoin"
var_InitLoin: "InitLoin"
var_Interne: "Interne"
var_jsInfobulle: "jsInfobulle"
var_JsInfobulle: "JsInfobulle"
var_jsWebsocket: "jsWebsocket"
var_JsWebsocket: "JsWebsocket"
var_LANGUE_NOM: "LANGUE_NOM"
var_Langue: "Langue"
var_Largeur: "Largeur"
Expand Down

0 comments on commit 982eb1e

Please sign in to comment.