svn commit: r1816269 - in /ofbiz/ofbiz-framework/trunk/themes/common: template/macro/HtmlFormMacroLibrary.ftl 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: r1816269 - in /ofbiz/ofbiz-framework/trunk/themes/common: template/macro/HtmlFormMacroLibrary.ftl webapp/common/js/util/OfbizUtil.js

Deepak Dixit-5
Author: deepak
Date: Sat Nov 25 08:40:17 2017
New Revision: 1816269

URL: http://svn.apache.org/viewvc?rev=1816269&view=rev
Log:
Improved: Replace Inline js with External js in renderDisplayField macro (OFBIZ-9843)
Thanks Aditya Sharma for your contribution

Modified:
    ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl
    ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js

Modified: ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl?rev=1816269&r1=1816268&r2=1816269&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common/template/macro/HtmlFormMacroLibrary.ftl Sat Nov 25 08:40:17 2017
@@ -28,7 +28,7 @@ under the License.
     <img src="${imageLocation}" alt=""><#lt/>
   <#else>
     <#if inPlaceEditorUrl?has_content || class?has_content || alert=="true" || title?has_content>
-      <span <#if idName?has_content>id="cc_${idName}"</#if> <#if title?has_content>title="${title}"</#if> <@renderClass class alert />><#t/>
+      <span data-inplace-editor-url="${inPlaceEditorUrl}" data-inplace-editor-params="${inPlaceEditorParams}" <#if idName?has_content>id="cc_${idName}"</#if> <#if title?has_content>title="${title}"</#if> <@renderClass class alert />><#t/>
     </#if>
 
     <#if description?has_content>
@@ -39,11 +39,6 @@ under the License.
     <#if inPlaceEditorUrl?has_content || class?has_content || alert=="true">
       </span><#lt/>
     </#if>
-    <#if inPlaceEditorUrl?has_content && idName?has_content>
-      <script language="JavaScript" type="text/javascript"><#lt/>
-        ajaxInPlaceEditDisplayField('cc_${idName}', '${inPlaceEditorUrl}', ${inPlaceEditorParams});<#lt/>
-      </script><#lt/>
-    </#if>
   </#if>
 </#macro>
 <#macro renderHyperlinkField></#macro>

Modified: ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js?rev=1816269&r1=1816268&r2=1816269&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js (original)
+++ ofbiz/ofbiz-framework/trunk/themes/common/webapp/common/js/util/OfbizUtil.js Sat Nov 25 08:40:17 2017
@@ -67,6 +67,13 @@ function bindObservers(bind_element) {
         }
         element.elrte(opts);
     });
+    jQuery(bind_element).find("[data-inplace-editor-url]").each(function(){
+        var element = jQuery(this);
+        var id =  element.attr("id");
+        var url = element.data("inplace-editor-url");
+        var params = element.data("inplace-editor-params");
+        ajaxInPlaceEditDisplayField(id, url, (new Function("return " + params + ";")()));
+    });
 
 }