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


Commits:
0bcd75ca by Tobias Jeger at 2016-05-27T11:11:22+02:00
CHANNELMGR-692 record changes when changing the menu

- - - - -
4e0a4a20 by Canh Ngo at 2016-05-30T13:45:30+02:00
CHANNELMGR-692 merged from feature/cmng-psp1

- - - - -
ca2cae49 by Canh Ngo at 2016-05-30T13:51:26+02:00
CHANNELMGR-692 merged to feature mainline

- - - - -


1 changed file:

- frontend-ng/src/angularjs/channel/menu/editor.controller.js


Changes:

=====================================
frontend-ng/src/angularjs/channel/menu/editor.controller.js
=====================================
--- a/frontend-ng/src/angularjs/channel/menu/editor.controller.js
+++ b/frontend-ng/src/angularjs/channel/menu/editor.controller.js
@@ -16,7 +16,7 @@
 
 export class MenuEditorCtrl {
   constructor($q, $filter, $scope, $translate, SiteMenuService, 
FormStateService, HippoIframeService, DialogService,
-              FeedbackService) {
+              FeedbackService, ChannelService) {
     'ngInject';
 
     this.$q = $q;
@@ -27,6 +27,7 @@ export class MenuEditorCtrl {
     this.HippoIframeService = HippoIframeService;
     this.DialogService = DialogService;
     this.FeedbackService = FeedbackService;
+    this.ChannelService = ChannelService;
 
     this.isSaving = {};
 
@@ -62,6 +63,7 @@ export class MenuEditorCtrl {
 
         if (source.nodesScope !== destNodesScope || source.index !== 
dest.index) {
           SiteMenuService.moveMenuItem(this.menuUuid, sourceId, destId, 
dest.index)
+            .then(() => { this.isMenuModified = true; })
             .catch(() => this.onError({ key: 'ERROR_MENU_MOVE_FAILED' }));
         }
       },
@@ -92,6 +94,7 @@ export class MenuEditorCtrl {
       .then((menu) => this._createBlankMenuItem(menu))
       .then((blankItem) => 
this.SiteMenuService.createEditableMenuItem(this.menuUuid, blankItem))
       .then((editableItem) => {
+        this.isMenuModified = true;
         this.FormStateService.setValid(true);
         this.isSaving.newItem = false;
         this._startEditingItem(editableItem);
@@ -105,7 +108,11 @@ export class MenuEditorCtrl {
   }
 
   onBack() {
-    this.HippoIframeService.reload().then(this.onDone);
+    if (this.isMenuModified) {
+      this.HippoIframeService.reload();
+      this.ChannelService.recordOwnChange();
+    }
+    this.onDone();
   }
 
   // TODO: Move this logic into the SiteMenuService. Don't make this 
controller worry about the prototypeItem.
@@ -124,7 +131,10 @@ export class MenuEditorCtrl {
 
   saveItem() {
     this.SiteMenuService.saveMenuItem(this.menuUuid, this.editingItem)
-      .then(() => this.stopEditingItem())
+      .then(() => {
+        this.isMenuModified = true;
+        this.stopEditingItem();
+      })
       .catch((response) => {
         response = response || {};
 
@@ -134,7 +144,10 @@ export class MenuEditorCtrl {
 
   _doDelete() {
     return this.SiteMenuService.deleteMenuItem(this.menuUuid, 
this.editingItem.id)
-      .then(() => this.stopEditingItem())
+      .then(() => {
+        this.isMenuModified = true;
+        this.stopEditingItem();
+      })
       .catch((response) => {
         response = response || {};
 



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

Reply via email to