Mathijs den Burger pushed to branch bugfix/CHANNELMGR-725 at cms-community / hippo-addon-channel-manager
Commits: e89bd9e8 by Mathijs den Burger at 2016-06-06T16:49:41+02:00 CHANNELMGR-725 Simplified/clarified code Renamed deleteComponentProperties to destroyComponentPropertiesWindow which is more explicit. The event after deleting a component succeeded or failed was generated in two places (both the success and failure case). We now generate it in one place: the finally handler. - - - - - 4ce3cd67 by Mathijs den Burger at 2016-06-06T16:52:27+02:00 CHANNELMGR-725 Don't fetch a .json property of an undefined record - - - - - 3 changed files: - frontend-ng/src/angularjs/channel/hippoIframe/hippoIframe.controller.js - frontend-ng/src/angularjs/channel/page/pageStructure.service.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 @@ -109,11 +109,8 @@ export class HippoIframeCtrl { _doDelete(componentId) { return () => this.PageStructureService.removeComponentById(componentId) - .then( - ({ oldContainer, newContainer }) => this.DragDropService.replaceContainer(oldContainer, newContainer), - // inform extjs to delete the component properties dialog if deletion fails - () => this.CmsService.publish('delete-component-properties') - ); + .then(({ oldContainer, newContainer }) => this.DragDropService.replaceContainer(oldContainer, newContainer)) + .finally(() => this.CmsService.publish('destroy-component-properties-window')); } _confirmDelete(selectedComponent) { ===================================== frontend-ng/src/angularjs/channel/page/pageStructure.service.js ===================================== --- a/frontend-ng/src/angularjs/channel/page/pageStructure.service.js +++ b/frontend-ng/src/angularjs/channel/page/pageStructure.service.js @@ -215,7 +215,6 @@ export class PageStructureService { _onAfterRemoveComponent() { this.ChannelService.recordOwnChange(); - this.CmsService.publish('delete-component-properties'); } getContainerByIframeElement(containerIFrameElement) { ===================================== 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 @@ -47,7 +47,7 @@ this.iframeToHost.subscribe('channel-changed-in-angular', this._reloadChannels, this); this.iframeToHost.subscribe('switch-channel', this._setChannel, this); this.iframeToHost.subscribe('show-component-properties', this._showComponentProperties, this); - this.iframeToHost.subscribe('delete-component-properties', this._deleteComponentPropertiesWindow, this); + this.iframeToHost.subscribe('destroy-component-properties-window', this._destroyComponentPropertiesWindow, this); this.iframeToHost.subscribe('show-picker', this._showPicker, this); this.iframeToHost.subscribe('open-content', this._openDocumentEditor, this); this.iframeToHost.subscribe('show-mask', this._maskSurroundings, this); @@ -81,9 +81,11 @@ _syncChannel: function() { this._reloadChannels().when(function (channelStore) { - var id = this.selectedChannel.id; - this.selectedChannel = channelStore.getById(id).json; - if (!this.selectedChannel) { + var id = this.selectedChannel.id, + channelRecord = channelStore.getById(id); + if (channelRecord) { + this.selectedChannel = channelRecord.json; + } else { // we may just have created the preview config of this channel this.selectedChannel = channelStore.getById(id + '-preview').json; } @@ -105,11 +107,11 @@ }, _onComponentLocked: function(data) { - this._deleteComponentPropertiesWindow(); + this._destroyComponentPropertiesWindow(); this.hostToIFrame.publish('reload-channel', data); }, - _deleteComponentPropertiesWindow: function() { + _destroyComponentPropertiesWindow: function() { if (this.componentPropertiesWindow) { this.componentPropertiesWindow.destroy(); } @@ -146,7 +148,7 @@ _initialize: function(channel) { this.selectedChannel = channel; - this._deleteComponentPropertiesWindow(); + this._destroyComponentPropertiesWindow(); // update breadcrumb this.setTitle(channel.name); @@ -179,7 +181,7 @@ hide: function() { this.hostToIFrame.publish('hide-component-properties'); }, - close: this._deleteComponentPropertiesWindow, + close: this._destroyComponentPropertiesWindow, scope: this } }); View it on GitLab: https://code.onehippo.org/cms-community/hippo-addon-channel-manager/compare/066e62c8544a3f2987c2d22b3fdf2b94050b3b49...4ce3cd67026120be2762667d0ffd5fca17ae5275
_______________________________________________ Hippocms-svn mailing list Hippocms-svn@lists.onehippo.org https://lists.onehippo.org/mailman/listinfo/hippocms-svn