Mathijs den Burger pushed to branch feature/CHANNELMGR-1660 at cms-community / 
hippo-addon-channel-manager


Commits:
84d981da by Mathijs den Burger at 2018-01-17T09:59:32+01:00
CHANNELMGR-1660 Fix 'publish' button

The previous commit directly closed the channel editor when a user chose
'discard' in the save-or-discard confirmation dialog. That worked nicely
when showing this dialog before closing a channel, but broke the
'publish' button: that still needs to discard the document after the
confirmation dialog has been shown, which did not work anymore because
the editor was already closed.

Fixed by not closing the content editor in confirmSaveOrDiscardChanges,
but doing it explicitly on-channel-close after the dialog has been
shown.

- - - - -


2 changed files:

- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/contentEditor.service.js
- 
frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.service.js


Changes:

=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/contentEditor.service.js
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/contentEditor.service.js
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/contentEditor/contentEditor.service.js
@@ -261,7 +261,6 @@ class ContentEditorService {
             return this._saveDraft()
               .then(() => action); // let caller know that changes have been 
saved
           default:
-            this.close();
             return this.$q.resolve(action); // let caller know that changes 
have not been saved
         }
       });


=====================================
frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.service.js
=====================================
--- 
a/frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.service.js
+++ 
b/frontend-ng/src/app/channel/sidePanels/rightSidePanel/editContent/editContent.service.js
@@ -29,7 +29,7 @@ class EditContentService {
     );
     $transitions.onBefore(
       { from: '**.edit-content', to: 'hippo-cm' },
-      () => 
this.ContentEditor.confirmSaveOrDiscardChanges('SAVE_CHANGES_ON_CLOSE_CHANNEL'),
+      () => this._onCloseChannel(),
     );
 
     CmsService.subscribe('kill-editor', (documentId) => {
@@ -69,6 +69,11 @@ class EditContentService {
     const documentTitle = this.$translate.instant('EDIT_DOCUMENT', document);
     this.RightSidePanelService.setTitle(documentTitle);
   }
+
+  _onCloseChannel() {
+    return 
this.ContentEditor.confirmSaveOrDiscardChanges('SAVE_CHANGES_ON_CLOSE_CHANNEL')
+      .then(() => this.ContentEditor.close());
+  }
 }
 
 export default EditContentService;



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/84d981da3ee4471af0f0edf851c3e35d2955b985

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-addon-channel-manager/commit/84d981da3ee4471af0f0edf851c3e35d2955b985
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to