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 8403157 Improved: Move page-specific script links to html template (OFBIZ-11799) 8403157 is described below commit 840315781a8698179293a5124c0a96b36b1b332f Author: James Yong <[hidden email]> AuthorDate: Tue Sep 1 22:10:37 2020 +0800 Improved: Move page-specific script links to html template (OFBIZ-11799) Use importLibrary js function to load jeditable js Tested page at example/control/authview/findExampleAjax --- .../webapp/common/js/util/OfbizUtil.js | 38 ++++++++++++---------- themes/common-theme/widget/CommonScreens.xml | 1 - themes/common-theme/widget/Theme.xml | 1 - themes/docs/themes.adoc | 1 - 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index c662c01..65f1940 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -1038,24 +1038,26 @@ function ajaxInPlaceEditDisplayField(element, url, options) { jQuery(this).css('background-color', 'transparent'); }); - jElement.editable(function(value, settings){ - // removes all line breaks from the value param, because the parseJSON Function can't work with line breaks - value = value.replace(/\n/g, " "); - value = value.replace(/\"/g,"""); - - var resultField = jQuery.parseJSON('{"' + settings.name + '":"' + value + '"}'); - // merge both parameter objects together - jQuery.extend(settings.submitdata, resultField); - jQuery.ajax({ - type : settings.method, - url : url, - data : settings.submitdata, - success : function(data) { - // adding the new value to the field and make the modified field 'blink' a little bit to show the user that somethink have changed - jElement.text(value).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).css('background-color', 'transparent'); - } - }); - }, options); + importLibrary(["/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js"], function() { + jElement.editable(function (value, settings) { + // removes all line breaks from the value param, because the parseJSON Function can't work with line breaks + value = value.replace(/\n/g, " "); + value = value.replace(/\"/g, """); + + var resultField = jQuery.parseJSON('{"' + settings.name + '":"' + value + '"}'); + // merge both parameter objects together + jQuery.extend(settings.submitdata, resultField); + jQuery.ajax({ + type: settings.method, + url: url, + data: settings.submitdata, + success: function (data) { + // adding the new value to the field and make the modified field 'blink' a little bit to show the user that somethink have changed + jElement.text(value).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).css('background-color', 'transparent'); + } + }); + }, options); + }); } // ===== End of Ajax Functions ===== // diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml index 41b236e..5a51420 100644 --- a/themes/common-theme/widget/CommonScreens.xml +++ b/themes/common-theme/widget/CommonScreens.xml @@ -437,7 +437,6 @@ under the License. <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.js" global="true"/> - <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/plugins/validate/jquery.validate.min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/plugins/browser-plugin/jquery.browser-0.1.0.min.js" global="true"/> <set field="layoutSettings.javaScripts[+0]" value="/common/js/jquery/jquery-migrate-3.3.0.min.js" global="true" /> diff --git a/themes/common-theme/widget/Theme.xml b/themes/common-theme/widget/Theme.xml index f4b842c..6730d5f 100644 --- a/themes/common-theme/widget/Theme.xml +++ b/themes/common-theme/widget/Theme.xml @@ -62,7 +62,6 @@ under the License. <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/browser-plugin/jquery.browser-0.1.0.min.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.js"/> - <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/validate/jquery.validate.min.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/util/OfbizUtil.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/util/fieldlookup.js"/> diff --git a/themes/docs/themes.adoc b/themes/docs/themes.adoc index e30f3e1..6f08147 100644 --- a/themes/docs/themes.adoc +++ b/themes/docs/themes.adoc @@ -287,7 +287,6 @@ The blue light theme has been these properties in VisualThemeRessource : <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.js" sequenceId="05"/> <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon.min-1.4.3.js" sequenceId="07"/> <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/jquery/plugins/mask/jquery.mask-1.14.13.min.js" sequenceId="10"/> - <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js" sequenceId="11"/> <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/jquery/plugins/validate/jquery.validate.min.js" sequenceId="12"/> <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/util/OfbizUtil.js" sequenceId="15"/> <VisualThemeResource visualThemeId="BLUELIGHT" resourceTypeEnumId="VT_HDR_JAVASCRIPT" resourceValue="/common/js/util/fieldlookup.js" sequenceId="16"/> |
Free forum by Nabble | Edit this page |