Canh Ngo pushed to branch bugfix/CHANNELMGR-496 at cms-community / 
hippo-addon-channel-manager


Commits:
fbefdc18 by Canh Ngo at 2016-03-22T16:36:16+01:00
CHANNELMGR-496: updated event subscriptions upon activating/deactivating the 
Channel Perspective

Changes in usage-statistics event names cause the Channel Manager breadcrumb 
not to hide properly. Corrected event subscription fixed this issue.

- - - - -


3 changed files:

- 
frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelManagerPerspective.java
- frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.java
- frontend/src/main/resources/org/onehippo/cms7/channelmanager/RootPanel.js


Changes:

=====================================
frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelManagerPerspective.java
=====================================
--- 
a/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelManagerPerspective.java
+++ 
b/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelManagerPerspective.java
@@ -45,7 +45,7 @@ public class ChannelManagerPerspective extends Perspective 
implements IChannelMa
 
     private static final CssResourceReference CHANNEL_MANAGER_PERSPECTIVE_CSS 
= new CssResourceReference(ChannelManagerPerspective.class, 
"ChannelManagerPerspective.css");
     private static final String EVENT_ID = "channels";
-    public static final String EVENT_PERSPECTIVE_DEACTIVATED = 
"perspective-deactivated";
+    public static final String EVENT_CMSCHANNELS_DEACTIVATED = 
"CMSChannels-deactivated";
 
     private final RootPanel rootPanel;
     private final boolean siteIsUp;
@@ -87,7 +87,7 @@ public class ChannelManagerPerspective extends Perspective 
implements IChannelMa
     @Override
     protected void onDeactivated() {
         super.onDeactivated();
-        publishEvent(EVENT_PERSPECTIVE_DEACTIVATED);
+        publishEvent(EVENT_CMSCHANNELS_DEACTIVATED);
     }
 
     @Override


=====================================
frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.java
=====================================
--- a/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.java
+++ b/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.java
@@ -178,7 +178,6 @@ public class RootPanel extends ExtPanel {
                 selectActiveItem(target);
                 redraw = false;
             }
-            
target.appendJavaScript("Ext.getCmp('rootPanel').showBreadcrumb();");
         }
     }
 


=====================================
frontend/src/main/resources/org/onehippo/cms7/channelmanager/RootPanel.js
=====================================
--- a/frontend/src/main/resources/org/onehippo/cms7/channelmanager/RootPanel.js
+++ b/frontend/src/main/resources/org/onehippo/cms7/channelmanager/RootPanel.js
@@ -85,8 +85,8 @@
         this.toolbar.render(hippoFooter, 0);
 
         // only show the channel manager breadcrumb when channel manager is 
active
-        Hippo.Events.subscribe('perspective-activated', 
this._showBreadcrumbForChannels, this);
-        Hippo.Events.subscribe('perspective-deactivated', 
this._hideBreadcrumbForChannels, this);
+        Hippo.Events.subscribe('CMSChannels', this.showBreadcrumb, this);
+        Hippo.Events.subscribe('CMSChannels-deactivated', this.hideBreadcrumb, 
this);
       }, this, {single: true});
 
       // get all child components
@@ -188,18 +188,6 @@
       this.showBreadcrumbTask.delay(0);
     },
 
-    _hideBreadcrumbForChannels: function(eventParameters) {
-      if (eventParameters && eventParameters.perspectiveId === 
this.perspectiveId) {
-        this.hideBreadcrumb();
-      }
-    },
-
-    _showBreadcrumbForChannels: function(eventParameters) {
-      if (eventParameters && eventParameters.perspectiveId === 
this.perspectiveId) {
-        this.showBreadcrumb();
-      }
-    },
-
     selectCard: function (itemId) {
       while (this.toolbar.getBreadcrumbSize() > 0) {
         this.toolbar.popItem();



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/fbefdc18f8ea78586b53c783c7908b3529cac460
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to