[ofbiz-framework] branch trunk updated: Improved: Change inline style to js for multiple select field (OFBIZ-12115)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Change inline style to js for multiple select field (OFBIZ-12115)

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

jamesyong 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 a66f0a9  Improved: Change inline style to js for multiple select field (OFBIZ-12115)
a66f0a9 is described below

commit a66f0a9be8d61b17ed0aeb4f635bc79d513a136d
Author: James Yong <[hidden email]>
AuthorDate: Fri Jan 1 13:13:46 2021 +0800

    Improved: Change inline style to js for multiple select field (OFBIZ-12115)
   
    Test pages at /ordermgr/control/FindRequest and /ordermgr/control/findorders
---
 .../template/includes/SetMultipleSelectJs.ftl        | 15 +++------------
 .../template/includes/SetMultipleSelectJsList.ftl    | 20 ++++++++------------
 2 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
index 8f089ce..d05c848 100644
--- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
+++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
@@ -55,18 +55,9 @@ jQuery(document).ready(function () {
         });
     });
 });
-</script>
-
-<style type="text/css">
     <#if asm_multipleSelectForm?? && asm_formSize??>
-    #${asm_multipleSelectForm}
-    {
-        width: ${asm_formSize!700}px;
-        position: relative;
-    }
+jQuery("#${asm_multipleSelectForm}").css({"width": "${asm_formSize!700}px", "position": "relative"});
     </#if>
-    .asmListItem {
-        width: ${asm_asmListItemPercentOfForm!95}%;
-    }
-</style>
+jQuery(".asmListItem").css("width", "${asm_asmListItemPercentOfForm!95}%")
+</script>
 </#if>
diff --git a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
index 4731f89..606e2f4 100644
--- a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
+++ b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
@@ -17,6 +17,7 @@ specific language governing permissions and limitations
 under the License.
 -->
 <#if asm_listField??> <#-- we check only this var and suppose the others are also present -->
+  <#assign ranOnce=false>
   <#list asm_listField as row>
     <#if row.asm_multipleSelect??>
       <script type="application/javascript">
@@ -57,19 +58,14 @@ under the License.
                   });
               });
           });
+          <#if !ranOnce>
+            <#assign ranOnce=true>
+            <#if asm_multipleSelectForm?? && asm_formSize??>
+          jQuery("#${asm_multipleSelectForm}").css({"width": "${asm_formSize!700}px", "position": "relative"});
+            </#if>
+          jQuery(".asmListItem").css("width", "${asm_asmListItemPercentOfForm!95}%")
+          </#if>
       </script>
     </#if>
   </#list>
-  <style type="text/css">
-      <#if asm_multipleSelectForm?? && asm_formSize??>
-      #${asm_multipleSelectForm}
-      {
-          width: ${asm_formSize!700}px;
-          position: relative;
-      }
-      </#if>
-      .asmListItem {
-          width: ${asm_asmListItemPercentOfForm!95}%;
-      }
-</style>
 </#if>