mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
refresh route after smart section edit
This commit is contained in:
parent
f0590139b1
commit
72e715919e
7 changed files with 25 additions and 33 deletions
|
@ -30,11 +30,11 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
toEdit: '',
|
||||
|
||||
didReceiveAttrs() {
|
||||
if (this.get('isDestroyed') || this.get('isDestroying')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.get('sectionService').getSpaceBlocks(this.get('folder.id')).then((blocks) => {
|
||||
if (this.get('isDestroyed') || this.get('isDestroying')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('blocks', blocks);
|
||||
this.set('hasBlocks', blocks.get('length') > 0);
|
||||
|
||||
|
@ -141,8 +141,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
promise.then((id) => {
|
||||
if (model.page.pageType === 'section') {
|
||||
this.set('toEdit', id);
|
||||
} else {
|
||||
this.get('onEditSection')(id);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -110,11 +110,16 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
|
||||
this.get('sectionService').fetch(page, "items", this.get('config'))
|
||||
.then(function (response) {
|
||||
// console.log(response);
|
||||
if (self.get('isDestroyed') || self.get('isDestroying')) {
|
||||
return;
|
||||
}
|
||||
self.set('items', response);
|
||||
self.set('config.itemCount', response.length);
|
||||
self.set('waiting', false);
|
||||
}, function (reason) { //jshint ignore: line
|
||||
if (self.get('isDestroyed') || self.get('isDestroying')) {
|
||||
return;
|
||||
}
|
||||
self.set('items', []);
|
||||
self.set('waiting', false);
|
||||
});
|
||||
|
|
|
@ -53,7 +53,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
this.get('documentService').copyPage(documentId, pageId, targetDocumentId).then(() => {
|
||||
this.showNotification("Moved");
|
||||
|
||||
this.send('onPageDeleted', { id: pageId, children: false });
|
||||
});
|
||||
},
|
||||
|
@ -70,8 +69,8 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
self.audit.record("edited-page");
|
||||
self.get('documentService').getPages(documentId).then((pages) => {
|
||||
self.set('model.pages', pages);
|
||||
self.get('target.router').refresh();
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -138,21 +137,22 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
this.get('documentService').getPages(this.get('model.document.id')).then((pages) => {
|
||||
this.set('model.pages', pages);
|
||||
resolve(newPage.id);
|
||||
|
||||
if (newPage.pageType === 'section') {
|
||||
resolve(newPage.id);
|
||||
} else {
|
||||
this.transitionToRoute('document.section',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
newPage.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onEditSection(pageId) {
|
||||
this.transitionToRoute('document.section',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
pageId);
|
||||
},
|
||||
|
||||
// to test
|
||||
onPageSequenceChange(changes) {
|
||||
this.get('documentService').changePageSequence(this.get('model.document.id'), changes).then(() => {
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
userService: Ember.inject.service('user'),
|
||||
queryParams: {
|
||||
pageId: {
|
||||
refreshModel: false
|
||||
refreshModel: true
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -38,7 +38,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
document: this.modelFor('document').document,
|
||||
pageId: this.get('pageId'),
|
||||
isEditor: this.get('folderService').get('canEditCurrentFolder'),
|
||||
pages: this.modelFor('document').pages,
|
||||
pages: this.get('documentService').getPages(this.modelFor('document').document.get('id')),
|
||||
links: this.modelFor('document').links,
|
||||
sections: this.modelFor('document').sections
|
||||
});
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
folder=model.folder folders=model.folders sections=model.sections isEditor=model.isEditor pageId=pageId
|
||||
onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
|
||||
onSavePageAsBlock=(action 'onSavePageAsBlock') onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage')
|
||||
onDeletePage=(action 'onPageDeleted') onEditSection=(action 'onEditSection')}}
|
||||
onDeletePage=(action 'onPageDeleted')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,8 +14,6 @@ import NotifierMixin from '../../../mixins/notifier';
|
|||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
queryParams: ['mode'],
|
||||
mode: null,
|
||||
|
||||
actions: {
|
||||
onCancel() {
|
||||
|
|
|
@ -17,15 +17,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
pageId: '',
|
||||
queryParams: {
|
||||
mode: {
|
||||
refreshModel: false
|
||||
}
|
||||
},
|
||||
|
||||
beforeModel(transition) {
|
||||
this.set('mode', !_.isUndefined(transition.queryParams.mode) ? transition.queryParams.mode : '');
|
||||
},
|
||||
|
||||
model(params) {
|
||||
return Ember.RSVP.hash({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue