You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2019/01/17 08:32:56 UTC
svn commit: r1851500 - in /ofbiz/ofbiz-framework/trunk/themes/common-theme:
template/macro/HtmlFormMacroLibrary.ftl webapp/common/js/util/OfbizUtil.js
Author: adityasharma
Date: Thu Jan 17 08:32:56 2019
New Revision: 1851500
URL: http://svn.apache.org/viewvc?rev=1851500&view=rev
Log:
Improved: Replace Inline js with External js in renderTextField macro
(OFBIZ-9844)
Modified:
ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js
Modified: ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl?rev=1851500&r1=1851499&r2=1851500&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl Thu Jan 17 08:32:56 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/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js?rev=1851500&r1=1851499&r2=1851500&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/util/OfbizUtil.js Thu Jan 17 08:32:56 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");