This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 210b63dc77 Improved: Swap dateTime field in French (OFBIZ-12822 - #640)
210b63dc77 is described below

commit 210b63dc77106b20116f53d119e634c4ed09fd4d
Author: MaximeFlame <36478972+maximefl...@users.noreply.github.com>
AuthorDate: Thu Feb 15 14:58:10 2024 +0100

    Improved: Swap dateTime field in French (OFBIZ-12822 - #640)
    
    This improvement focuses on enhancing the syntax of Apache OFBiz by 
swapping the order of the dropdown field and the text field for French date 
time input. Specifically, this change applies only to the French language.
    
    By default, the date time input in Apache OFBiz consists of a text field 
followed by a dropdown field for selecting the time. However, for French users, 
it is more intuitive to have the dropdown field for selecting the time appear 
before the text field.
    
    This improvement modifies the syntax to accommodate the French language, 
ensuring a more user-friendly and natural experience for French-speaking users.
    
    Please note that this change is language-specific and will not affect other 
languages or locales.
    
    This improvement aims to align the date time input order with French user 
expectations and contribute to a smoother user experience in Apache OFBiz.
---
 .../macro/RenderableFtlFormElementsBuilder.java    |  3 +-
 .../template/macro/HtmlFormMacroLibrary.ftl        | 46 ++++++++++++++++------
 2 files changed, 35 insertions(+), 14 deletions(-)

diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/RenderableFtlFormElementsBuilder.java
 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/RenderableFtlFormElementsBuilder.java
index 8a62d3a5ff..853ae19b28 100644
--- 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/RenderableFtlFormElementsBuilder.java
+++ 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/RenderableFtlFormElementsBuilder.java
@@ -586,7 +586,8 @@ public final class RenderableFtlFormElementsBuilder {
                 .stringParameter("tabindex", modelFormField.getTabindex())
                 .stringParameter("conditionGroup", 
modelFormField.getConditionGroup())
                 .stringParameter("defaultOptionFrom", 
dateFindField.getDefaultOptionFrom(context))
-                .stringParameter("defaultOptionThru", 
dateFindField.getDefaultOptionThru(context));
+                .stringParameter("defaultOptionThru", 
dateFindField.getDefaultOptionThru(context))
+                .stringParameter("language", locale.getLanguage());
 
         macroCallBuilder.booleanParameter("alert", false);
         if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) {
diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl 
b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
index 667c91e9f5..e5ef6dd36b 100644
--- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
+++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
@@ -452,7 +452,7 @@ under the License.
   </#if>
 </#macro>
 
-<#macro renderDateFindField id name formName defaultOptionFrom 
defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan 
opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty className="" 
alert=false imgSrc="" value="" isTimeType=false isDateType=false 
conditionGroup="" localizedInputTitle="" value2="" size="" maxlength="" 
titleStyle="" tabindex="" disabled=false>
+<#macro renderDateFindField id name formName defaultOptionFrom 
defaultOptionThru opEquals opSameDay opGreaterThanFromDayStart opGreaterThan 
opGreaterThan opLessThan opUpToDay opUpThruDay opIsEmpty language="" 
className="" alert=false imgSrc="" value="" isTimeType=false isDateType=false 
conditionGroup="" localizedInputTitle="" value2="" size="" maxlength="" 
titleStyle="" tabindex="" disabled=false>
   <#if conditionGroup?has_content>
     <input type="hidden" name="${name}_grp" value="${conditionGroup}" 
<@renderDisabled disabled />/>
   </#if>
@@ -465,6 +465,14 @@ under the License.
   <#local timePicker = 
"/common/js/node_modules/@chinchilla-software/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.min.js,/common/js/node_modules/@chinchilla-software/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.css"/>
   <#local timePickerLang = 
Static["org.apache.ofbiz.common.JsLanguageFilesMappingUtil"].getFile("dateTime",
 .locale)/>
   <span class="view-calendar">
+    <#if language?matches("fr.*")>
+      <select <@renderDisabled disabled /> <#if name?has_content> 
name="${name}_fld0_op"</#if> class="selectBox"><#rt/>
+        <option value="equals"<#if defaultOptionFrom=="equals"> 
selected="selected"</#if>>${opEquals}</option><#rt/>
+        <option value="sameDay"<#if defaultOptionFrom=="sameDay"> 
selected="selected"</#if>>${opSameDay}</option><#rt/>
+        <option value="greaterThanFromDayStart"<#if 
defaultOptionFrom=="greaterThanFromDayStart"> 
selected="selected"</#if>>${opGreaterThanFromDayStart}</option><#rt/>
+        <option value="greaterThan"<#if defaultOptionFrom=="greaterThan"> 
selected="selected"</#if>>${opGreaterThan}</option><#rt/>
+      </select><#rt/>
+    </#if>
     <input id="${id}_fld0_value" type="text" <@renderClass className alert?c 
/> <@renderDisabled disabled />
         <#if name?has_content> name="${name?html}_fld0_value"</#if>
         <#if localizedInputTitle?has_content> 
title="${localizedInputTitle}"</#if>
@@ -481,16 +489,26 @@ under the License.
     <#if titleStyle?has_content>
       <span class="${titleStyle}"><#rt/>
     </#if>
-    <select <@renderDisabled disabled /> <#if name?has_content> 
name="${name}_fld0_op"</#if> class="selectBox"><#rt/>
-      <option value="equals"<#if defaultOptionFrom=="equals"> 
selected="selected"</#if>>${opEquals}</option><#rt/>
-      <option value="sameDay"<#if defaultOptionFrom=="sameDay"> 
selected="selected"</#if>>${opSameDay}</option><#rt/>
-      <option value="greaterThanFromDayStart"<#if 
defaultOptionFrom=="greaterThanFromDayStart"> 
selected="selected"</#if>>${opGreaterThanFromDayStart}</option><#rt/>
-      <option value="greaterThan"<#if defaultOptionFrom=="greaterThan"> 
selected="selected"</#if>>${opGreaterThan}</option><#rt/>
-    </select><#rt/>
+      <#if !language?matches("fr.*")>
+        <select <@renderDisabled disabled /> <#if name?has_content> 
name="${name}_fld0_op"</#if> class="selectBox"><#rt/>
+          <option value="equals"<#if defaultOptionFrom=="equals"> 
selected="selected"</#if>>${opEquals}</option><#rt/>
+          <option value="sameDay"<#if defaultOptionFrom=="sameDay"> 
selected="selected"</#if>>${opSameDay}</option><#rt/>
+          <option value="greaterThanFromDayStart"<#if 
defaultOptionFrom=="greaterThanFromDayStart"> 
selected="selected"</#if>>${opGreaterThanFromDayStart}</option><#rt/>
+          <option value="greaterThan"<#if defaultOptionFrom=="greaterThan"> 
selected="selected"</#if>>${opGreaterThan}</option><#rt/>
+        </select><#rt/>
+      </#if>
     <#if titleStyle?has_content>
       </span><#rt/>
     </#if>
     <#rt/>
+    <#if language?matches("fr.*")>
+      <select name=<#if name?has_content>"${name}_fld1_op"</#if> 
class="selectBox" <@renderDisabled disabled />><#rt/>
+        <option value="opLessThan"<#if defaultOptionThru=="opLessThan"> 
selected="selected"</#if>>${opLessThan}</option><#rt/>
+        <option value="upToDay"<#if defaultOptionThru=="upToDay"> 
selected="selected"</#if>>${opUpToDay}</option><#rt/>
+        <option value="upThruDay"<#if defaultOptionThru=="upThruDay"> 
selected="selected"</#if>>${opUpThruDay}</option><#rt/>
+        <option value="empty"<#if defaultOptionFrom=="empty"> 
selected="selected"</#if>>${opIsEmpty}</option><#rt/>
+      </select><#rt/>
+    </#if>
     <input id="${id}_fld1_value" type="text" <@renderClass className alert?c 
/> <@renderDisabled disabled />
         <#if name?has_content> name="${name}_fld1_value"</#if>
         <#if localizedInputTitle??> title="${localizedInputTitle?html}"</#if>
@@ -506,12 +524,14 @@ under the License.
     <#if titleStyle?has_content>
       <span class="${titleStyle}"><#rt/>
     </#if>
-    <select name=<#if name?has_content>"${name}_fld1_op"</#if> 
class="selectBox" <@renderDisabled disabled />><#rt/>
-      <option value="opLessThan"<#if defaultOptionThru=="opLessThan"> 
selected="selected"</#if>>${opLessThan}</option><#rt/>
-      <option value="upToDay"<#if defaultOptionThru=="upToDay"> 
selected="selected"</#if>>${opUpToDay}</option><#rt/>
-      <option value="upThruDay"<#if defaultOptionThru=="upThruDay"> 
selected="selected"</#if>>${opUpThruDay}</option><#rt/>
-      <option value="empty"<#if defaultOptionFrom=="empty"> 
selected="selected"</#if>>${opIsEmpty}</option><#rt/>
-    </select><#rt/>
+      <#if !language?matches("fr.*")>
+        <select name=<#if name?has_content>"${name}_fld1_op"</#if> 
class="selectBox" <@renderDisabled disabled />><#rt/>
+          <option value="opLessThan"<#if defaultOptionThru=="opLessThan"> 
selected="selected"</#if>>${opLessThan}</option><#rt/>
+          <option value="upToDay"<#if defaultOptionThru=="upToDay"> 
selected="selected"</#if>>${opUpToDay}</option><#rt/>
+          <option value="upThruDay"<#if defaultOptionThru=="upThruDay"> 
selected="selected"</#if>>${opUpThruDay}</option><#rt/>
+          <option value="empty"<#if defaultOptionFrom=="empty"> 
selected="selected"</#if>>${opIsEmpty}</option><#rt/>
+        </select><#rt/>
+      </#if>
     <#if titleStyle?has_content>
       </span>
     </#if>

Reply via email to