Skip to content

Commit

Permalink
Adding new handlebars partials for customizing action buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Jul 6, 2023
1 parent e0258dd commit b62a800
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/computate/frFR/java/ConfigCles.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class ConfigCles {
public static final String var_avant = "var_avant";
public static final String var_Avant = "var_Avant";
public static final String var_BaseApiServiceImpl = "var_BaseApiServiceImpl";
public static final String var_Bouton = "var_Bouton";
public static final String var_PageBase = "var_PageBase";
public static final String var_calendrier = "var_calendrier";
public static final String var_Calendrier = "var_Calendrier";
Expand Down
67 changes: 32 additions & 35 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1763,9 +1763,13 @@ else if("LocalDate".equals(entiteNomSimple)) {
String classeApiMethodeMethode = classeDoc.getString("classeApiMethode" + classeApiMethode + "_" + langueNom + "_stored_string");

if(classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PageRecherche))) {
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Bouton), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"Page\"}}{{/partial}}");
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Formulaire), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"Page\"}}{{/partial}}");
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Formulaire), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"Page\"}}{{/partial}}");
} else if(classeApiMethode.equals("PATCH") || classeApiMethode.equals("POST") || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTCopie)) || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Bouton), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"", classeApiMethodeMethode, "\"}}{{/partial}}");
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Formulaire), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"", classeApiMethodeMethode, "\"}}{{/partial}}");
l("{{#partial \"htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{> htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), classePageNomSimple, "_", classeApiOperationIdMethode, " classApiMethodMethod=\"", classeApiMethodeMethode, "\"}}{{/partial}}");
}
}
}
Expand Down Expand Up @@ -3000,6 +3004,7 @@ else if(entiteAttribuer) {
l("/>");
tl(2, "</form>");
tl(0, "{{#if ", classeVarCleUnique, "}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", StringUtils.lowerCase(langueConfig.getString(ConfigCles.var_PageRecherche)), classeApiClasseNomSimple, "\"}}{{/block}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", StringUtils.lowerCase(langueConfig.getString(ConfigCles.var_PageRecherche)), classeApiClasseNomSimple, "\"}}{{/block}}");
tl(0, "{{/if}}");
l("{{/inline}}");
Expand All @@ -3012,7 +3017,6 @@ else if(entiteAttribuer) {
String classeApiMethodeMethode = classeDoc.getString("classeApiMethode" + classeApiMethode + "_" + langueNom + "_stored_string");

if(classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PageRecherche)) || classeApiMethode.equals("PATCH") || classeApiMethode.equals("POST") || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTCopie)) || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
l("{{#*inline \"htm", langueConfig.getString(ConfigCles.var_Formulaire), classePageNomSimple, "_", classeApiOperationIdMethode, "\"}}");
String methodeTitreFiltres = null;
String methodeTitreValeurs = null;

Expand Down Expand Up @@ -3044,6 +3048,7 @@ else if("DELETE".equals(classeApiMethodeMethode)) {
methodeTitreValeurs = langueConfig.getString(ConfigCles.str_Rechercher_) + classeNomPluriel;
}

l("{{#*inline \"htm", langueConfig.getString(ConfigCles.var_Bouton), classePageNomSimple, "_", classeApiOperationIdMethode, "\"}}");
if(!classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PageRecherche))) {
tl(2, "<button");
tl(3, "class=\"w3-btn w3-round w3-border w3-border-black w3-ripple w3-padding w3-", classeCouleur, " \"");
Expand All @@ -3064,6 +3069,26 @@ else if(classeApiMethode.contains(langueConfig.getString(ConfigCles.var_PUTCopie
tl(3, methodeTitreValeurs);
tl(2, "</button>");
}
l("{{/inline}}");
l("{{#*inline \"htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), classePageNomSimple, "_", classeApiOperationIdMethode, "\"}}");
tl(6, "<button");
tl(7, "class=\"w3-btn w3-round w3-border w3-border-black w3-ripple w3-padding w3-margin w3-", classeCouleur, " \"");
if("POST".equals(classeApiMethodeMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, "Form')); \"");
else if("PATCH".equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "(null, $('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if("PUTImport".equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTFusion).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTCopie).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else
tl(7, "onclick=\"", classeApiOperationIdMethode, "(); \"");

tl(7, ">", methodeTitreValeurs, "</button>");
l("{{/inline}}");
l("{{#*inline \"htm", langueConfig.getString(ConfigCles.var_Formulaire), classePageNomSimple, "_", classeApiOperationIdMethode, "\"}}");
{ tl(2, "<div id=\"", classeApiOperationIdMethode, langueConfig.getString(ConfigCles.var_Modale), "\" class=\"", classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PageRecherche)) ? "" : "w3-modal ", "\">");
{ tl(3, "<div class=\"", classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PageRecherche)) ? "" : "w3-modal-content ", "\">");
{ tl(4, "<div class=\"w3-card-4 \">");
Expand Down Expand Up @@ -3105,21 +3130,7 @@ else if(classeApiMethode.contains(langueConfig.getString(ConfigCles.var_PUTCopie
s(wFormPATCH);
}

tl(6, "<button");
tl(7, "class=\"w3-btn w3-round w3-border w3-border-black w3-ripple w3-padding w3-margin w3-", classeCouleur, " \"");

if("PATCH".equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "(null, $('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if("PUTImport".equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTFusion).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTCopie).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "')); \"");
else
tl(7, "onclick=\"", classeApiOperationIdMethode, "\"");

tl(7, ">", methodeTitreValeurs, "</button>");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
} else {
{ tl(6, "<div id=\"", classeApiOperationIdMethode, "Form\">");

Expand All @@ -3133,24 +3144,7 @@ else if(langueConfig.getString(ConfigCles.var_PUTCopie).equals(classeApiMethode)

} tl(6, "</div>");
if(!langueConfig.getString(ConfigCles.var_PageRecherche).equals(classeApiMethode)) {
tl(6, "<button");
tl(7, "class=\"w3-btn w3-round w3-border w3-border-black w3-ripple w3-padding w3-margin w3-", classeCouleur, " \"");
if("POST".equals(classeApiMethodeMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, "Form')); \"");
else if("PATCH".equals(classeApiMethodeMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, langueConfig.getString(ConfigCles.var_FormulaireFiltres), "'), $('#", classeApiOperationIdMethode, classePageLangueConfig.getString(ConfigCles.var_FormulaireValeurs), "'), function() {}, function() {}); \"");
else if("PUTImport".equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, "Form')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTFusion).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, "Form')); \"");
else if(langueConfig.getString(ConfigCles.var_PUTCopie).equals(classeApiMethode))
tl(7, "onclick=\"", classeApiOperationIdMethode, "($('#", classeApiOperationIdMethode, "Form'), \", ", uncapitalizeClasseApiClasseNomSimple, "_ == null ? \"null\" : ", uncapitalizeClasseApiClasseNomSimple, "_.get", StringUtils.capitalize(classeVarClePrimaire), "(), \"; \")");
else if(classeApiMethodeMethode.contains("PATCH") || classeApiMethodeMethode.contains("POST") || classeApiMethodeMethode.contains("PUT"))
tl(7, "onclick=\"", classeApiOperationIdMethode, "(\", o.get", StringUtils.capitalize(classeVarClePrimaire), "(), \"; \")");
else
tl(7, "onclick=\"", classeApiOperationIdMethode, "(); \"");

tl(7, ">", methodeTitreValeurs, "</button>");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
}
}
} tl(5, "</div>");
Expand Down Expand Up @@ -3501,17 +3495,20 @@ else if(classeApiMethodeMethode.contains("PATCH") || classeApiMethodeMethode.con
}
l("{{#eq ", uncapitalizeClasseApiClasseNomSimple, "Count int1}}");
l("{{#if ", classeVarCleUnique, "}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{else}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{/if}}");
l("{{else}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{/eq}}");
if(activerRoleAdmin) {
l("{{/ifContainsAnyRoles}}");
}
} else if(classeApiMethode.equals("PATCH") || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTCopie)) || classeApiMethode.equals(langueConfig.getString(ConfigCles.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
tl(0, "{{#ifContainsAnyRoles roles ", langueConfig.getString(ConfigCles.var_authRoleSuperAdmin), "}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Bouton), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
l("{{#block \"htm", langueConfig.getString(ConfigCles.var_Formulaire), "_", classeApiOperationIdMethode, "\"}}{{/block}}");
tl(0, "{{/ifContainsAnyRoles}}");
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/org/computate/i18n/i18n_enUS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ var_AUTRES_LANGUES: "OTHER_LANGUAGES"
var_avant: "before"
var_Avant: "Before"
var_BaseApiServiceImpl: "BaseApiServiceImpl"
var_Bouton: "Button"
var_PageBase: "BasePage"
var_calendrier: "calendar"
var_Calendrier: "Calendar"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/org/computate/i18n/i18n_frFR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ var_AUTRES_LANGUES: "AUTRES_LANGUES"
var_avant: "avant"
var_Avant: "Avant"
var_BaseApiServiceImpl: "BaseApiServiceImpl"
var_Bouton: "Bouton"
var_PageBase: "PageBase"
var_calendrier: "calendrier"
var_Calendrier: "Calendrier"
Expand Down

0 comments on commit b62a800

Please sign in to comment.