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 9960b1c  Improved: Move page-specific script links to html template 
(OFBIZ-11799)
9960b1c is described below

commit 9960b1cdb8db423435ddf4be411d32507948caac
Author: James Yong <jamesy...@apache.org>
AuthorDate: Sun Aug 23 12:23:15 2020 +0800

    Improved: Move page-specific script links to html template (OFBIZ-11799)
    
    Use importLibrary js function to load jstree in DisplayContentNav.ftl.
    Tested page at
    
/exampleext/control/showHelp?helpTopic=EXAMPLEEXT_main&portalPageId=&formName=help&presentation=undefined&id=undefined
---
 .../content/template/content/DisplayContentNav.ftl | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/applications/content/template/content/DisplayContentNav.ftl 
b/applications/content/template/content/DisplayContentNav.ftl
index e7ed363..8a8b01b 100644
--- a/applications/content/template/content/DisplayContentNav.ftl
+++ b/applications/content/template/content/DisplayContentNav.ftl
@@ -16,9 +16,7 @@
   specific language governing permissions and limitations
   under the License.
   -->
-<script data-import="head" type="application/javascript" 
src="/common/js/util/OfbizUtil.js"></script>
-<script data-import="head" type="application/javascript" 
src="/common/js/jquery/plugins/jsTree/jquery.jstree.js"></script>
-
+<script type="application/javascript" src="/common/js/util/OfbizUtil.js"/>
 <script type="application/javascript">
 <#-- some labels are not unescaped in the JSON object so we have to do this 
manuely -->
 function unescapeHtmlText(text) {
@@ -66,12 +64,18 @@ var rawdata = [
  
<#-------------------------------------------------------------------------------------create
 Tree-->
   function createTree() {
     jQuery(function () {
-        jQuery("#tree").jstree({
-            "plugins" : [ "themes", "json_data", "ui", "crrm"],
-            "json_data" : {
-                "data" : rawdata,
-                "progressive_render" : false
-            },
+        importLibrary(["/common/js/jquery/plugins/jsTree/jquery.jstree.js"], 
function() {
+            jQuery("#tree").jstree({
+                "plugins": ["themes", "json_data", "ui", "crrm"],
+                "json_data": {
+                    "data": rawdata,
+                    "progressive_render": false
+                },
+                "themes": {
+                    "theme": "default",
+                    "url": 
"/common/js/jquery/plugins/jsTree/themes/default/style.css"
+                }
+            });
         });
     });
   }

Reply via email to