This is an automated email from the ASF dual-hosted git repository.
florianmo 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 8ba5174afb Improved: style helveticus locale selection page, add
filter (OFBIZ-13354) (#954)
8ba5174afb is described below
commit 8ba5174afbb20921cc79bf9512e6d7060bcedbe4
Author: Florian Motteau <[email protected]>
AuthorDate: Thu Feb 5 13:58:04 2026 +0100
Improved: style helveticus locale selection page, add filter (OFBIZ-13354)
(#954)
Improved: Style locale selection page on Helveticus theme. Add a plain
text filter to quickly find what you're searching.
(OFBIZ-13354)
Thanks: Néréide team
---
framework/common/config/CommonUiLabels.xml | 9 ++
.../helveticus/template/includes/ListLocales.ftl | 138 +++++++++++++++++++++
themes/helveticus/template/includes/Lookup.ftl | 112 +++++++++++++++++
themes/helveticus/widget/CommonScreens.xml | 133 ++++++++++++++++++++
themes/helveticus/widget/LookupScreens.xml | 47 +++++++
themes/helveticus/widget/Theme.xml | 6 +
6 files changed, 445 insertions(+)
diff --git a/framework/common/config/CommonUiLabels.xml
b/framework/common/config/CommonUiLabels.xml
index 894d90f247..f443e377a8 100644
--- a/framework/common/config/CommonUiLabels.xml
+++ b/framework/common/config/CommonUiLabels.xml
@@ -13729,6 +13729,15 @@
<value xml:lang="zh-CN">邮编</value>
<value xml:lang="zh-TW">郵遞區號</value>
</property>
+ <property key="CommonTypeToFilter">
+ <value xml:lang="ar">تصفية</value>
+ <value xml:lang="de">filtern</value>
+ <value xml:lang="en">filter</value>
+ <value xml:lang="es">filtrar</value>
+ <value xml:lang="es-CL">filtrar</value>
+ <value xml:lang="es-MX">filtrar</value>
+ <value xml:lang="fr">filtrer</value>
+ </property>
<property key="Content">
<value xml:lang="ar">المحتوى</value>
<value xml:lang="cs">Obsah</value>
diff --git a/themes/helveticus/template/includes/ListLocales.ftl
b/themes/helveticus/template/includes/ListLocales.ftl
new file mode 100644
index 0000000000..7e50b4db62
--- /dev/null
+++ b/themes/helveticus/template/includes/ListLocales.ftl
@@ -0,0 +1,138 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<div id="localeContainer">
+ <div id="header">
+ <input class="filter" id="search" type="text"
placeholder="${uiLabelMap.CommonTypeToFilter}" autofocus/>
+ <a href="<@ofbizUrl>main</@ofbizUrl>">${uiLabelMap.CommonCancel}</a>
+ </div>
+ <div id="locales">
+ <#assign availableLocales =
Static["org.apache.ofbiz.base.util.UtilMisc"].availableLocales()/>
+ <#list availableLocales as availableLocale>
+ <#assign langAttr = availableLocale.toString()?replace("_", "-")>
+ <#assign langDir = "ltr">
+ <#if
!Static["java.awt.ComponentOrientation"].getOrientation(availableLocale).isLeftToRight()>
+ <#assign langDir = "rtl">
+ </#if>
+ <div class="locale" lang="${langAttr}" dir="${langDir}">
+ <a
href="<@ofbizUrl>setSessionLocale?newLocale=${availableLocale.toString()}</@ofbizUrl>">
+
${availableLocale.getDisplayName(availableLocale)} [${langAttr}]
+ </a>
+ </div>
+ </#list>
+ </div>
+</div>
+
+<script>
+ $(document).ready( function() {
+ $('#search').on('keyup', function() {
+ const value = $(this).val().toLowerCase();
+ $('#locales .locale').filter(function() {
+ const t = $(this);
+ t.toggle(t.text().toLowerCase().indexOf(value) > -1)
+ });
+ });
+ });
+</script>
+
+<style>
+ /* always reserve scrollbar width, to prevent flickering when filtering
locales and scrollbar appears/disappears */
+ html {
+ scrollbar-gutter: stable;
+ }
+
+ body {
+ display: flex;
+ flex-direction: column;
+ padding: 2rem;
+ background-color: #181c32 !important;
+
+ #localeContainer {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ #header {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ width: 100%;
+ max-width: 52rem;
+ margin: 2rem 0;
+
+ input {
+ height: 4rem;
+ font-size: 3rem;
+ padding: 2rem;
+ background-color: #3F4254;
+ color: white;
+ }
+
+ a {
+ display: inline-block;
+ font-size: 2rem;
+ margin-top: 2rem;
+ color: white;
+
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+ }
+
+ #locales {
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ gap: 1rem;
+
+ /* avoid a last line with big gaps between locales */
+ &::after {
+ content: "";
+ flex: auto;
+ }
+
+ .locale {
+ width: fit-content;
+ border: 1px solid #dfe0e4;
+ border-radius: 0.5rem;
+ transition: all 0.1s ease-in-out;
+ background-color: #3F4254;
+ font-size: 1.6rem;
+
+ &:hover {
+ background-color: #e1f0ff;
+ border: 1px solid #e1f0ff;
+ }
+
+ a {
+ display: inline-block;
+ padding: 1rem;
+ color: white;
+ font-weight: bold;
+ cursor: pointer;
+
+ &:hover {
+ color: #181c32
+ }
+ }
+ }
+ }
+ }
+ }
+</style>
diff --git a/themes/helveticus/template/includes/Lookup.ftl
b/themes/helveticus/template/includes/Lookup.ftl
new file mode 100644
index 0000000000..a81775b78c
--- /dev/null
+++ b/themes/helveticus/template/includes/Lookup.ftl
@@ -0,0 +1,112 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<#assign docLangAttr = locale.toString()?replace("_", "-")>
+<#assign initialLocale = locale.toString()>
+<#assign langDir = "ltr">
+<#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
+ <#assign langDir = "rtl">
+</#if>
+<html lang="${docLangAttr}" dir="${langDir}"
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>${title!}</title>
+ <#if layoutSettings.shortcutIcon?has_content>
+ <#assign shortcutIcon = layoutSettings.shortcutIcon/>
+ <#elseif layoutSettings.VT_SHORTCUT_ICON?has_content>
+ <#assign shortcutIcon = layoutSettings.VT_SHORTCUT_ICON />
+ </#if>
+ <#if shortcutIcon?has_content>
+ <link rel="shortcut icon"
href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)+".ico"}</@ofbizContentUrl>"
type="image/x-icon">
+ <link rel="icon"
href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)+".png"}</@ofbizContentUrl>"
type="image/png">
+ <link rel="icon" sizes="32x32"
href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)+"-32.png"}</@ofbizContentUrl>"
type="image/png">
+ <link rel="icon" sizes="64x64"
href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)+"-64.png"}</@ofbizContentUrl>"
type="image/png">
+ <link rel="icon" sizes="96x96"
href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)+"-96.png"}</@ofbizContentUrl>"
type="image/png">
+ </#if>
+ <#if layoutSettings.VT_STYLESHEET_LESS?has_content>
+ <#list layoutSettings.VT_STYLESHEET_LESS as styleSheet>
+ <link rel="stylesheet/less"
href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>"
type="text/css"/>
+ </#list>
+ </#if>
+ <#if layoutSettings.javaScripts?has_content>
+ <#--layoutSettings.javaScripts is a list of java scripts. -->
+ <#-- use a Set to make sure each javascript is declared only once, but
iterate the list to maintain the correct order -->
+ <#assign javaScriptsSet =
Static["org.apache.ofbiz.base.util.UtilMisc"].toSet(layoutSettings.javaScripts)/>
+ <#list layoutSettings.javaScripts as javaScript>
+ <#if javaScriptsSet.contains(javaScript)>
+ <#assign nothing = javaScriptsSet.remove(javaScript)/>
+ <script
src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>"
+ type="text/javascript"></script>
+ </#if>
+ </#list>
+ </#if>
+ <#if layoutSettings.styleSheets?has_content>
+ <#list layoutSettings.styleSheets as styleSheet>
+ <link rel="stylesheet"
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>" type="text/css"/>
+ </#list>
+ </#if>
+ <#if layoutSettings.VT_STYLESHEET?has_content>
+ <#list layoutSettings.VT_STYLESHEET as styleSheet>
+ <link rel="stylesheet"
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>" type="text/css"/>
+ </#list>
+ </#if>
+ <#if layoutSettings.VT_HELPSTYLESHEET?has_content &&
lookupType?has_content>
+ <#list layoutSettings.VT_HELPSTYLESHEET as styleSheet>
+ <link rel="stylesheet"
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>" type="text/css"/>
+ </#list>
+ </#if>
+ <#if layoutSettings.rtlStyleSheets?has_content && "rtl" == langDir>
+ <#list layoutSettings.rtlStyleSheets as styleSheet>
+ <link rel="stylesheet"
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>" type="text/css"/>
+ </#list>
+ </#if>
+ <#if layoutSettings.VT_RTL_STYLESHEET?has_content && "rtl" == langDir>
+ <#list layoutSettings.VT_RTL_STYLESHEET as styleSheet>
+ <link rel="stylesheet"
href="<@ofbizContentUrl>${styleSheet}</@ofbizContentUrl>" type="text/css"/>
+ </#list>
+ </#if>
+
+ <script type="text/javascript">
+ // This code inserts the value lookedup by a popup window back into
the associated form element
+ var re_id = new RegExp('id=(\\d+)');
+ var num_id = (re_id.exec(String(window.location))
+ ? new Number(RegExp.$1) : 0);
+ var obj_caller = (window.opener ? window.opener.lookups[num_id] :
null);
+ if (obj_caller == null)
+ obj_caller = window.opener;
+
+ // function passing selected value to calling window
+ function set_multivalues(value) {
+ obj_caller.target.value = value;
+ var thisForm = obj_caller.target.form;
+ var evalString = "";
+
+ if (arguments.length > 2) {
+ for (var i = 1; i < arguments.length; i = i + 2) {
+ evalString = "setSourceColor(thisForm." + arguments[i] +
")";
+ eval(evalString);
+ evalString = "thisForm." + arguments[i] + ".value='" +
arguments[i + 1] + "'";
+ eval(evalString);
+ }
+ }
+ window.close();
+ }
+ </script>
+</head>
+<body style="background-color: WHITE;">
diff --git a/themes/helveticus/widget/CommonScreens.xml
b/themes/helveticus/widget/CommonScreens.xml
new file mode 100644
index 0000000000..2fe8ccb349
--- /dev/null
+++ b/themes/helveticus/widget/CommonScreens.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ofbiz.apache.org/Widget-Screen"
xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen
http://ofbiz.apache.org/dtds/widget-screen.xsd">
+ <!-- Global decorator for Lookup pop-up windows or layered CSS -->
+ <screen name="LookupDecorator">
+ <section>
+ <condition>
+ <not>
+ <if-compare operator="equals" value="Y"
field="parameters.ajaxLookup"/>
+ </not>
+ </condition>
+ <widgets>
+ <section>
+ <actions>
+ <property-map resource="CommonUiLabels"
map-name="uiLabelMap" global="true"/>
+ <service service-name="getUserPreferenceGroup"
result-map="prefResult">
+ <field-map field-name="userPrefGroupTypeId"
value="GLOBAL_PREFERENCES"/>
+ </service>
+ <set field="userPreferences"
from-field="prefResult.userPrefMap" global="true"/>
+
+ <property-map resource="general"
map-name="generalProperties" global="true"/>
+ <set field="defaultOrganizationPartyId"
from-field="userPreferences.ORGANIZATION_PARTY" global="true"/>
+
+ <set field="messagesTemplateLocation"
from-field="layoutSettings.VT_MSG_TMPLT_LOC"
default-value="component://common-theme/template/includes/Messages.ftl"/>
+ <set field="layoutSettings.styleSheets[]"
value="/common/js/node_modules/featherlight/release/featherlight.min.css"
global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/featherlight/release/featherlight.min.js"
global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/jquery-ui-dist/jquery-ui.min.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/jquery-validation/dist/jquery.validate.min.js"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/jquery.browser/dist/jquery.browser.min.js"
global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/jquery-migrate/dist/jquery-migrate.min.js"
global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/jquery/dist/jquery.min.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]"
value="/common/js/node_modules/dompurify/dist/purify.min.js" global="true"/>
+ <set field="layoutSettings.javaScripts[]"
value="/common/js/util/OfbizUtil.js" global="true"/>
+ </actions>
+ <widgets>
+ <section>
+ <condition>
+ <if-compare value="layer"
operator="not-equals" field="parameters.presentation"/>
+ </condition>
+ <widgets>
+ <platform-specific>
+ <html>
+ <html-template
location="component://helveticus/template/includes/Lookup.ftl"/>
+ </html>
+ </platform-specific>
+ </widgets>
+ </section>
+ <platform-specific>
+ <html>
+ <html-template
location="${messagesTemplateLocation}"/>
+ </html>
+ </platform-specific>
+ <section>
+ <condition>
+ <not>
+ <if-empty-section section-name="body"/>
+ </not>
+ </condition>
+ <widgets>
+ <decorator-section-include name="body"/>
+ </widgets>
+ <fail-widgets>
+ <screenlet title="${title}" id="findScreenlet"
collapsible="true" padded="false">
+ <container id="search-options">
+ <decorator-section-include
name="search-options"/>
+ </container>
+ </screenlet>
+ <screenlet>
+ <container id="search-results">
+ <decorator-section-include
name="search-results"/>
+ </container>
+ </screenlet>
+ </fail-widgets>
+ </section>
+ <section>
+ <condition>
+ <if-compare value="layer"
operator="not-equals" field="parameters.presentation"/>
+ </condition>
+ <widgets>
+ <platform-specific>
+ <html>
+ <html-template
location="component://common-theme/template/includes/LookupFooter.ftl"/>
+ </html>
+ </platform-specific>
+ </widgets>
+ </section>
+ </widgets>
+ </section>
+ </widgets>
+ <fail-widgets>
+ <section>
+ <actions>
+ <property-map resource="CommonUiLabels"
map-name="uiLabelMap" global="true"/>
+ <set field="searchType"
from-field="parameters.searchType" default-value="${searchType}"/>
+ <set field="autocompleterViewSize"
from-field="parameters.autocompleterViewSize"
+ default-value="${groovy:
modelTheme.getAutocompleterDefaultViewSize()}"/>
+ <script
location="component://common/src/main/groovy/org/apache/ofbiz/common/FindAutocompleteOptions.groovy"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="AjaxGlobalDecorator">
+ <decorator-section name="body">
+ <platform-specific>
+ <html>
+ <html-template
location="component://common-theme/template/includes/AjaxAutocompleteOptions.ftl"/>
+ </html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </fail-widgets>
+ </section>
+ </screen>
+</screens>
\ No newline at end of file
diff --git a/themes/helveticus/widget/LookupScreens.xml
b/themes/helveticus/widget/LookupScreens.xml
new file mode 100644
index 0000000000..7182f4848d
--- /dev/null
+++ b/themes/helveticus/widget/LookupScreens.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://ofbiz.apache.org/Widget-Screen"
xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen
http://ofbiz.apache.org/dtds/widget-screen.xsd">
+
+ <!-- Locales Lookup Screen -->
+ <screen name="ListLocales">
+ <section>
+ <actions>
+ <set field="layoutSettings.javaScripts[]"
value="/helveticus/js/less.min.js"/>
+ <set field="layoutSettings.VT_STYLESHEET_LESS[]"
value="/helveticus/helveticus.less" global="true"/>
+ <set field="title"
from-field="uiLabelMap.CommonChooseLanguage"/>
+ <set field="parameters.presentation" value="window"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="LookupDecorator"
location="component://helveticus/widget/CommonScreens.xml">
+ <decorator-section name="body">
+ <platform-specific>
+ <html>
+ <html-template
location="component://helveticus/template/includes/ListLocales.ftl"/>
+ </html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+
+</screens>
diff --git a/themes/helveticus/widget/Theme.xml
b/themes/helveticus/widget/Theme.xml
index 1944ba28f7..27b3a1f2eb 100644
--- a/themes/helveticus/widget/Theme.xml
+++ b/themes/helveticus/widget/Theme.xml
@@ -69,4 +69,10 @@ under the License.
<template-file widget="form"
location="component://helveticus/template/macro/HtmlFormMacroLibrary.ftl"/>
</template>
</templates>
+
+ <common-screens>
+ <generic-screen
default-location="component://helveticus/widget/CommonScreens.xml">
+ <screen name="ListLocales"
location="component://helveticus/widget/LookupScreens.xml"/>
+ </generic-screen>
+ </common-screens>
</theme>