Canh Ngo pushed to branch feature/cmng-psp1-CHANNELMGR-592 at cms-community / 
hippo-addon-channel-manager


Commits:
9c774189 by Arthur Bogaart at 2016-04-28T15:16:37+02:00
CHANNELMGR-592 Review changes

I simplified the code in #deleteComponent a bit and fixed mvn lint

- - - - -


2 changed files:

- frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
- 
frontend/src/main/resources/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.js


Changes:

=====================================
frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
=====================================
--- a/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
+++ b/frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js
@@ -94,16 +94,18 @@ export class HippoIframeCtrl {
       this.$log.warn(`Cannot delete unknown component with 
id:'${componentId}'`);
       return;
     }
-    this._confirmDelete(selectedComponent)
-      .then(() => this.PageStructureService.removeComponentById(componentId)
-        .then(
-          ({ oldContainer, newContainer }) => 
this.DragDropService.replaceContainer(oldContainer, newContainer),
-          () => {
-            // inform extjs to reset the component properties dialog if 
deletion is failed
-            this.CmsService.publish('reset-component-properties');
-          }
-        ),
-        () => 
this.PageStructureService.showComponentProperties(selectedComponent)
+    this._confirmDelete(selectedComponent).then(
+      this._doDelete(componentId),
+      () => 
this.PageStructureService.showComponentProperties(selectedComponent)
+    );
+  }
+
+  _doDelete(componentId) {
+    return () => this.PageStructureService.removeComponentById(componentId)
+      .then(
+        ({ oldContainer, newContainer }) => 
this.DragDropService.replaceContainer(oldContainer, newContainer),
+        // inform extjs to reset the component properties dialog if deletion 
is failed
+        () => this.CmsService.publish('reset-component-properties')
       );
   }
 


=====================================
frontend/src/main/resources/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.js
=====================================
--- 
a/frontend/src/main/resources/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.js
+++ 
b/frontend/src/main/resources/org/onehippo/cms7/channelmanager/channeleditor/ChannelEditor.js
@@ -88,8 +88,8 @@
       this._resetComponentPropertiesWindow();
       this.hostToIFrame.publish('reload-channel', data);
     },
-    
-    _resetComponentPropertiesWindow() {
+
+    _resetComponentPropertiesWindow: function() {
       if (this.componentPropertiesWindow) {
         this.componentPropertiesWindow.destroy();
       }



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

Reply via email to