[ofbiz-plugins] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)

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

[ofbiz-plugins] branch trunk updated: Improved: Move page-specific script links to html template (OFBIZ-11799)

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-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 429c9b4  Improved: Move page-specific script links to html template (OFBIZ-11799)
429c9b4 is described below

commit 429c9b4acd503bfbfccdb3d7570f3fca6fd5fa3e
Author: James Yong <[hidden email]>
AuthorDate: Sat Aug 22 15:53:53 2020 +0800

    Improved: Move page-specific script links to html template (OFBIZ-11799)
   
    Use importLibrary js function to load jstree and cookies js at ProductCategories.ftl
---
 ecommerce/template/catalog/ProductCategories.ftl | 36 ++++++++++++------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/ecommerce/template/catalog/ProductCategories.ftl b/ecommerce/template/catalog/ProductCategories.ftl
index e948baa..6487399 100644
--- a/ecommerce/template/catalog/ProductCategories.ftl
+++ b/ecommerce/template/catalog/ProductCategories.ftl
@@ -16,11 +16,6 @@
   specific language governing permissions and limitations
   under the License.
   -->
-<script type="application/javascript"
-        src="<@ofbizContentUrl>/common/js/jquery/plugins/jsTree/jquery.jstree.js</@ofbizContentUrl>"></script>
-<script type="application/javascript"
-        src="<@ofbizContentUrl>/common/js/jquery/ui/js/jquery.cookie-1.4.0.js</@ofbizContentUrl>"></script>
-
 <script type="application/javascript">
   <#-- some labels are not unescaped in the JSON object so we have to do this manuely -->
   function unescapeHtmlText(text) {
@@ -74,19 +69,24 @@
 
   <#-------------------------------------------------------------------------------------create Tree-->
   function createTree() {
-    jQuery(function () {
-      jQuery("#tree").jstree({
-        "themes": {
-          "theme": "classic",
-          "icons": false
-        },
-        "cookies": {
-          "cookie_options": {path: '/'}
-        },
-        "plugins": ["themes", "json_data", "cookies"],
-        "json_data": {
-          "data": rawdata
-        }
+    importLibrary(["/common/js/jquery/ui/js/jquery.cookie-1.4.0.js"], function(){
+      importLibrary(["/common/js/jquery/plugins/jsTree/jquery.jstree.js"], function(){
+        jQuery(function () {
+          jQuery("#tree").jstree({
+            "themes": {
+              "theme": "classic",
+              "url": "/common/js/jquery/plugins/jsTree/themes/classic/style.css",
+              "icons": false
+            },
+            "cookies": {
+              "cookie_options": {path: '/'}
+            },
+            "plugins": ["themes", "json_data", "cookies"],
+            "json_data": {
+              "data": rawdata
+            }
+          });
+        });
       });
     });
   }