svn commit: r1851502 - in /ofbiz/ofbiz-framework/branches/release18.12: ./ themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl themes/common-theme/webapp/common/js/util/OfbizUtil.js

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

svn commit: r1851502 - in /ofbiz/ofbiz-framework/branches/release18.12: ./ themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl themes/common-theme/webapp/common/js/util/OfbizUtil.js

adityasharma
Author: adityasharma
Date: Thu Jan 17 08:34:07 2019
New Revision: 1851502

URL: http://svn.apache.org/viewvc?rev=1851502&view=rev
Log:
Applied fix from trunk for revision: 1851500
===

Improved: Replace Inline js with External js in renderTextField macro
(OFBIZ-9844)

Modified:
    ofbiz/ofbiz-framework/branches/release18.12/   (props changed)
    ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js

Propchange: ofbiz/ofbiz-framework/branches/release18.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 17 08:34:07 2019
@@ -10,4 +10,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1850015,1850023,1850530,1850647,1850685,1850694,1850711,1850914,1850918,1850921,1850948,1850953,1851006,1851013,1851068,1851074,1851130,1851158,1851200,1851224,1851247,1851254,1851315,1851319,1851350,1851353,1851433
+/ofbiz/ofbiz-framework/trunk:1850015,1850023,1850530,1850647,1850685,1850694,1850711,1850914,1850918,1850921,1850948,1850953,1851006,1851013,1851068,1851074,1851130,1851158,1851200,1851224,1851247,1851254,1851315,1851319,1851350,1851353,1851433,1851500

Modified: ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl?rev=1851502&r1=1851501&r2=1851502&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl Thu Jan 17 08:34:07 2019
@@ -45,6 +45,15 @@ under the License.
 
 <#macro renderTextField name className alert value="" textSize="" maxlength="" id="" event="" action="" disabled="" clientAutocomplete="" ajaxUrl="" ajaxEnabled="" mask="" tabindex="" readonly="" placeholder="" delegatorName="default">
   <input type="text" name="${name?default("")?html}"<#t/>
+  <#if ajaxEnabled?has_content && ajaxEnabled && ajaxUrl?has_content>
+    <#local defaultMinLength = modelTheme.getAutocompleterDefaultMinLength()>
+    <#local defaultDelay = modelTheme.getAutocompleterDefaultDelay()>
+    <#local className = className + " ajaxAutoCompleter"/>
+     data-show-description="false"<#rt/>
+     data-default-minlength="${defaultMinLength!2}"<#rt/>
+     data-ajax-url="${ajaxUrl!}"<#rt/>
+     data-default-delay="${defaultDelay!300}"<#rt/>
+  </#if>
     <@renderClass className alert />
     <#if value?has_content> value="${value}"</#if><#rt/>
     <#if textSize?has_content> size="${textSize}"</#if><#rt/>
@@ -59,11 +68,6 @@ under the License.
     <#if tabindex?has_content> tabindex="${tabindex}"</#if><#rt/>
     require
   /><#t/>
-  <#if ajaxEnabled?has_content && ajaxEnabled>
-    <#local defaultMinLength = modelTheme.getAutocompleterDefaultMinLength()>
-    <#local defaultDelay = modelTheme.getAutocompleterDefaultDelay()>
-    <script type="application/javascript">ajaxAutoCompleter('${ajaxUrl!}', false, ${defaultMinLength!2}, ${defaultDelay!300});</script><#lt/>
-  </#if>
 </#macro>
 
 <#macro renderTextareaField name className alert cols="" rows="" maxlength="" id="" readonly="" value="" visualEditorEnable="" buttons="" tabindex="" language="">

Modified: ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js?rev=1851502&r1=1851501&r2=1851502&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js Thu Jan 17 08:34:07 2019
@@ -76,6 +76,14 @@ function bindObservers(bind_element) {
         }
         element.elrte(opts);
     });
+    jQuery(bind_element).find(".ajaxAutoCompleter").each(function(){
+        var element = jQuery(this);
+        var ajaxUrl = element.data("ajax-url");
+        var showDescription = element.data("show-description");
+        var defaultMinLength = element.data("default-minlength");
+        var defaultDelay = element.data("default-delay");
+        ajaxAutoCompleter(ajaxUrl, showDescription, defaultMinLength, defaultDelay);
+    });
     jQuery(bind_element).find("[data-inplace-editor-url]").each(function(){
         var element = jQuery(this);
         var id =  element.attr("id");