1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

Save smart sections correctly post callback refactoring

This commit is contained in:
sauls8t 2018-01-24 14:00:12 +00:00
parent adef6dfffa
commit c0d70e38de
6 changed files with 18 additions and 16 deletions

View file

@ -119,6 +119,7 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
model.Page.Status = workflow.ChangePending
}
} else {
model.Page.RelativeID = ""
model.Page.Status = workflow.ChangePublished
}

View file

@ -280,16 +280,13 @@ export default Component.extend(TooltipMixin, {
return;
}
let page = {
documentId: this.get('document.id'),
title: `${block.get('title')}`,
level: 1,
sequence: 1024,
body: block.get('body'),
contentType: block.get('contentType'),
pageType: block.get('pageType'),
blockId: block.get('id')
};
let page = models.PageModel.create();
page.set('documentId', this.get('document.id'));
page.set('title', `${block.get('title')}`);
page.set('body', block.get('body'));
page.set('contentType', block.get('contentType'));
page.set('pageType', block.get('pageType'));
page.set('blockId', block.get('id'));
let meta = {
documentId: this.get('document.id'),

View file

@ -121,7 +121,7 @@ export default Component.extend({
page.set('title', title);
meta.set('rawBody', this.getBody());
let cb = this.get('onCancel');
let cb = this.get('onAction');
cb(page, meta);
}
}

View file

@ -52,9 +52,9 @@ export default Component.extend(SectionMixin, NotifierMixin, {
displayError(reason) {
if (netUtil.isAjaxAccessError(reason)) {
this.showNotification(`Unable to authenticate`);
// this.showNotification(`Unable to authenticate`);
} else {
this.showNotification(`Something went wrong, try again!`);
// this.showNotification(`Something went wrong, try again!`);
}
},
@ -181,7 +181,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
}, function (reason) { // eslint-disable-line no-unused-vars
self.set('authenticated', false);
self.set('waiting', false);
self.showNotification(`Something went wrong, try again!`);
// self.showNotification(`Something went wrong, try again!`);
});
}
}

View file

@ -10,7 +10,7 @@
// https://documize.com
import $ from 'jquery';
import { schedule } from 'ember/runloop';
import { schedule } from '@ember/runloop';
import { computed } from '@ember/object';
import Component from '@ember/component';

View file

@ -10,6 +10,7 @@
// https://documize.com
import { Promise as EmberPromise } from 'rsvp';
import { schedule } from '@ember/runloop';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import TooltipMixin from '../../../mixins/tooltip';
@ -143,7 +144,10 @@ export default Controller.extend(TooltipMixin, {
this.get('document.slug'),
newPage.id);
} else {
resolve(newPage.id);
schedule('afterRender', () => {
this.set('currentPageId', newPage.id);
resolve(newPage.id);
});
}
});
});