[ofbiz-framework] 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-framework] 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-framework.git


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

commit 7322abbcbe88bed5fe9babfc883c9dfc6de685f7
Author: James Yong <[hidden email]>
AuthorDate: Mon Aug 17 20:45:47 2020 +0800

    Improved: Move page-specific script links to html template (OFBIZ-11799)
   
    refactoring
---
 themes/common-theme/template/includes/GeoLocation.ftl          |  4 ++--
 themes/common-theme/template/includes/SetMultipleSelectJs.ftl  |  4 ++--
 .../common-theme/template/includes/SetMultipleSelectJsList.ftl |  4 ++--
 themes/common-theme/webapp/common/js/util/OfbizUtil.js         | 10 +++++-----
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl
index f87383e..d27b494 100644
--- a/themes/common-theme/template/includes/GeoLocation.ftl
+++ b/themes/common-theme/template/includes/GeoLocation.ftl
@@ -115,8 +115,8 @@ under the License.
     <#elseif "GEOPT_OSM" == geoChart.dataSourceId>
     <div id="${id}" class="map" style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}; height:${geoChart.height}; margin:2em auto;"></div>
     <script type="application/javascript">
-        var importLibraryFiles = ["/common/js/plugins/OpenLayers-5.3.0.js", "/common/js/plugins/OpenLayers-5.3.0.css"];
-        importLibrary(importLibraryFiles, function() {
+        var libraryFiles = ["/common/js/plugins/OpenLayers-5.3.0.js", "/common/js/plugins/OpenLayers-5.3.0.css"];
+        importLibrary(libraryFiles, function() {
             var iconFeatures=[];
 
             <#if geoChart.points?has_content>
diff --git a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
index b02022a..acf835d 100644
--- a/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
+++ b/themes/common-theme/template/includes/SetMultipleSelectJs.ftl
@@ -19,10 +19,10 @@ under the License.
 <#if asm_multipleSelect??> <#-- we check only this var and suppose the others are also present -->
 <script type="application/javascript">
 jQuery(document).ready(function () {
-    var importLibraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js",
+    var libraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js",
         "/common/js/jquery/plugins/select2/css/select2-4.0.6.css",
         "<@jsLangFilesMap>select2</@jsLangFilesMap>"];
-    importLibrary(importLibraryFiles, function(){
+    importLibrary(libraryFiles, function(){
 
         multiple = jQuery("#${asm_multipleSelect!}");
 
diff --git a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
index 3aebffd..e59cec4 100644
--- a/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
+++ b/themes/common-theme/template/includes/SetMultipleSelectJsList.ftl
@@ -21,10 +21,10 @@ under the License.
     <#if row.asm_multipleSelect??>
       <script type="application/javascript">
           jQuery(document).ready(function () {
-              var importLibraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js",
+              var libraryFiles = ["/common/js/jquery/plugins/select2/js/select2-4.0.6.js",
                   "/common/js/jquery/plugins/select2/css/select2-4.0.6.css",
                   "<@jsLangFilesMap>select2</@jsLangFilesMap>"];
-              importLibrary(importLibraryFiles, function() {
+              importLibrary(libraryFiles, function() {
                   multiple = jQuery("#${row.asm_multipleSelect!}");
 
                   <#if row.asm_title??>
diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
index c08d60d..394828a 100644
--- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js
+++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
@@ -101,9 +101,9 @@ function bindObservers(bind_element) {
     });
     jQuery(bind_element).find(".visual-editor").each(function(){
         var self = this;
-        var importLibraryFiles = ["https://localhost:8443/common/js/jquery/plugins/elrte-1.3/js/elrte.min.js",
-            "https://localhost:8443/common/js/jquery/plugins/elrte-1.3/css/elrte.min.css"];
-        importLibrary(importLibraryFiles, function() {
+        var libraryFiles = ["/common/js/jquery/plugins/elrte-1.3/js/elrte.min.js",
+            "/common/js/jquery/plugins/elrte-1.3/css/elrte.min.css"];
+        importLibrary(libraryFiles, function() {
             var element = jQuery(self);
             var toolbar = element.data('toolbar');
             var language = element.data('language');
@@ -1463,8 +1463,8 @@ var importLibrary = function() {
                     return importLibraryFiles.get(url);
                 }
             })
-        ).then(onSuccessFn).catch(onErrorFn || function () {
-            alert('Error loading one of the files: \n' + urls.join('\n'))
+        ).then(onSuccessFn).catch(onErrorFn || function (err) {
+            alert('Error:\n'+err+'\n\nFile(s): \n' + urls.join('\n'))
         });
     }
 }();