[ofbiz-framework] branch trunk updated: Fixed: showjGrowl called twice (OFBIZ-11720)

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: Fixed: showjGrowl called twice (OFBIZ-11720)

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 e46c7b9  Fixed: showjGrowl called twice (OFBIZ-11720)
e46c7b9 is described below

commit e46c7b97249d0d7c74d3833f0c8b69cc4881c8e0
Author: James Yong <[hidden email]>
AuthorDate: Thu May 21 21:38:08 2020 +0800

    Fixed: showjGrowl called twice (OFBIZ-11720)
   
    showjGrowl function is called twice,
    even when there is no message to show.
---
 themes/common-theme/template/includes/Messages.ftl | 42 +++++++++-------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/themes/common-theme/template/includes/Messages.ftl b/themes/common-theme/template/includes/Messages.ftl
index 78f82ab..78996db 100644
--- a/themes/common-theme/template/includes/Messages.ftl
+++ b/themes/common-theme/template/includes/Messages.ftl
@@ -57,17 +57,10 @@ under the License.
       </#if>
     </div>
   </#if>
-  <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")>
-  <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")>
-  <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")>
-  <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")>
 
-  <script>showjGrowl(
-          "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}",
-          "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}");</script>
   <#-- display the event messages -->
   <#if (eventMessage?has_content || eventMessageList?has_content)>
-  <div id="content-messages" class="content-messages eventMessage"
+    <div id="content-messages" class="content-messages eventMessage"
       onclick="document.getElementById('content-messages').parentNode.removeChild(this)">
     <#noescape><p>${uiLabelMap.CommonFollowingOccurred}:</p></#noescape>
     <#if eventMessage?has_content>
@@ -78,24 +71,17 @@ under the License.
         <p>${StringUtil.wrapString(eventMsg)}</p>
       </#list>
     </#if>
-  </div>
-  <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")>
-  <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")>
-  <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")>
-  <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")>
-  <script>showjGrowl(
-          "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}",
-          "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}");</script>
+    </div>
   </#if>
 
-   <#-- display the warning messages -->
+  <#-- display the warning messages -->
   <#if (warningMessage?has_content || warningMessageList?has_content)>
     <div id="content-messages" class="content-messages errorMessage"
         onclick="document.getElementById('content-messages').parentNode.removeChild(this)">
-      <#noescape><p>${uiLabelMap.CommonFollowingErrorsOccurred}:</p></#noescape>
-      <#if warningMessage?has_content>
-        <p>${StringUtil.wrapString(warningMessage)}</p>
-      </#if>
+    <#noescape><p>${uiLabelMap.CommonFollowingErrorsOccurred}:</p></#noescape>
+    <#if warningMessage?has_content>
+      <p>${StringUtil.wrapString(warningMessage)}</p>
+    </#if>
       <#if warningMessageList?has_content>
         <#list warningMessageList as warningMsg>
           <p>${StringUtil.wrapString(warningMsg)}</p>
@@ -103,12 +89,16 @@ under the License.
       </#if>
     </div>
   </#if>
-  <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")>
-  <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")>
-  <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")>
-  <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")>
 
-  <script>showjGrowl(
+  <#if (errorMessage?has_content || errorMessageList?has_content
+     || eventMessage?has_content || eventMessageList?has_content
+     || warningMessage?has_content || warningMessageList?has_content)>
+    <#assign jGrowlPosition = modelTheme.getProperty("jgrowlPosition")>
+    <#assign jGrowlWidth = modelTheme.getProperty("jgrowlWidth")>
+    <#assign jGrowlHeight = modelTheme.getProperty("jgrowlHeight")>
+    <#assign jGrowlSpeed = modelTheme.getProperty("jgrowlSpeed")>
+    <script>showjGrowl(
           "${uiLabelMap.CommonShowAll}", "${uiLabelMap.CommonCollapse}", "${uiLabelMap.CommonHideAllNotifications}",
           "${jGrowlPosition}", "${jGrowlWidth}", "${jGrowlHeight}", "${jGrowlSpeed}");</script>
+  </#if>
 </#escape>