mirror of
https://github.com/documize/community.git
synced 2025-07-20 21:59:42 +02:00
Save smart sections correctly post callback refactoring
This commit is contained in:
parent
adef6dfffa
commit
c0d70e38de
6 changed files with 18 additions and 16 deletions
|
@ -119,6 +119,7 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
||||||
model.Page.Status = workflow.ChangePending
|
model.Page.Status = workflow.ChangePending
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
model.Page.RelativeID = ""
|
||||||
model.Page.Status = workflow.ChangePublished
|
model.Page.Status = workflow.ChangePublished
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,16 +280,13 @@ export default Component.extend(TooltipMixin, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let page = {
|
let page = models.PageModel.create();
|
||||||
documentId: this.get('document.id'),
|
page.set('documentId', this.get('document.id'));
|
||||||
title: `${block.get('title')}`,
|
page.set('title', `${block.get('title')}`);
|
||||||
level: 1,
|
page.set('body', block.get('body'));
|
||||||
sequence: 1024,
|
page.set('contentType', block.get('contentType'));
|
||||||
body: block.get('body'),
|
page.set('pageType', block.get('pageType'));
|
||||||
contentType: block.get('contentType'),
|
page.set('blockId', block.get('id'));
|
||||||
pageType: block.get('pageType'),
|
|
||||||
blockId: block.get('id')
|
|
||||||
};
|
|
||||||
|
|
||||||
let meta = {
|
let meta = {
|
||||||
documentId: this.get('document.id'),
|
documentId: this.get('document.id'),
|
||||||
|
|
|
@ -121,7 +121,7 @@ export default Component.extend({
|
||||||
page.set('title', title);
|
page.set('title', title);
|
||||||
meta.set('rawBody', this.getBody());
|
meta.set('rawBody', this.getBody());
|
||||||
|
|
||||||
let cb = this.get('onCancel');
|
let cb = this.get('onAction');
|
||||||
cb(page, meta);
|
cb(page, meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,9 @@ export default Component.extend(SectionMixin, NotifierMixin, {
|
||||||
|
|
||||||
displayError(reason) {
|
displayError(reason) {
|
||||||
if (netUtil.isAjaxAccessError(reason)) {
|
if (netUtil.isAjaxAccessError(reason)) {
|
||||||
this.showNotification(`Unable to authenticate`);
|
// this.showNotification(`Unable to authenticate`);
|
||||||
} else {
|
} 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
|
}, function (reason) { // eslint-disable-line no-unused-vars
|
||||||
self.set('authenticated', false);
|
self.set('authenticated', false);
|
||||||
self.set('waiting', false);
|
self.set('waiting', false);
|
||||||
self.showNotification(`Something went wrong, try again!`);
|
// self.showNotification(`Something went wrong, try again!`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { schedule } from 'ember/runloop';
|
import { schedule } from '@ember/runloop';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { Promise as EmberPromise } from 'rsvp';
|
import { Promise as EmberPromise } from 'rsvp';
|
||||||
|
import { schedule } from '@ember/runloop';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import TooltipMixin from '../../../mixins/tooltip';
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
@ -143,7 +144,10 @@ export default Controller.extend(TooltipMixin, {
|
||||||
this.get('document.slug'),
|
this.get('document.slug'),
|
||||||
newPage.id);
|
newPage.id);
|
||||||
} else {
|
} else {
|
||||||
|
schedule('afterRender', () => {
|
||||||
|
this.set('currentPageId', newPage.id);
|
||||||
resolve(newPage.id);
|
resolve(newPage.id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue