1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

Introduce new nofications framework

Integrated https://github.com/documize/iziToast and added 4 log levels.
This commit is contained in:
sauls8t 2018-12-05 13:44:10 +00:00
parent f44cda66e6
commit f05a6fc999
40 changed files with 4187 additions and 1031 deletions

View file

@ -46,9 +46,8 @@ export default Controller.extend(Tooltips, Notifier, {
},
onSaveDocument(doc) {
this.showWait();
this.get('documentService').save(doc).then(() => {
this.showDone();
this.notifySuccess('Saved');
});
this.get('browser').setTitle(doc.get('name'));
this.get('browser').setMetaDescription(doc.get('excerpt'));
@ -103,10 +102,8 @@ export default Controller.extend(Tooltips, Notifier, {
meta: meta.toJSON({ includeId: true })
};
this.showWait();
this.get('documentService').updatePage(documentId, page.get('id'), model).then((/*up*/) => {
this.showDone();
this.notifySuccess('Saved');
this.get('documentService').fetchPages(documentId, this.get('session.user.id')).then((pages) => {
this.set('pages', pages);
@ -155,13 +152,11 @@ export default Controller.extend(Tooltips, Notifier, {
},
onInsertSection(data) {
this.showWait();
return new EmberPromise((resolve) => {
this.get('documentService').addPage(this.get('document.id'), data).then((newPage) => {
let data = this.get('store').normalize('page', newPage);
this.get('store').push(data);
this.showDone();
this.notifySuccess('Inserted');
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((pages) => {
this.set('pages', pages);
@ -198,44 +193,36 @@ export default Controller.extend(Tooltips, Notifier, {
},
onSaveTemplate(name, desc) {
this.showWait();
this.get('templateService').saveAsTemplate(this.get('document.id'), name, desc).then(function () {
this.showDone();
this.notifySuccess('Template saved');
});
},
onPageSequenceChange(currentPageId, changes) {
this.showWait();
this.set('currentPageId', currentPageId);
this.get('documentService').changePageSequence(this.get('document.id'), changes).then(() => {
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then( (pages) => {
this.set('pages', pages);
this.showDone();
});
});
},
onPageLevelChange(currentPageId, changes) {
this.showWait();
this.set('currentPageId', currentPageId);
this.get('documentService').changePageLevel(this.get('document.id'), changes).then(() => {
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then( (pages) => {
this.set('pages', pages);
this.showDone();
});
});
},
onTagChange(tags) {
this.showDone();
let doc = this.get('document');
doc.set('tags', tags);
this.get('documentService').save(doc).then(()=> {
this.showWait();
this.notifySuccess('Saved');
});
},

View file

@ -27,9 +27,8 @@ export default Controller.extend(Notifier, {
},
onSaveDocument(doc) {
this.showWait();
this.get('documentService').save(doc).then(() => {
this.showDone();
this.notifySuccess('Saved');
});
this.get('browser').setTitle(doc.get('name'));

View file

@ -23,8 +23,6 @@ export default Controller.extend(Notifier, {
},
onAction(page, meta) {
this.showWait();
let b = this.get('model.block');
b.set('title', page.get('title'));
b.set('body', page.get('body'));
@ -34,7 +32,7 @@ export default Controller.extend(Notifier, {
b.set('externalSource', meta.get('externalSource'));
this.get('sectionSvc').updateBlock(b).then(() => {
this.showDone();
this.notifySuccess('Saved');
this.get('router').transitionTo('folder.settings', {queryParams: {tab: 'blocks'}});
});
}

View file

@ -67,8 +67,6 @@ export default Controller.extend(NotifierMixin, {
},
onExportDocument(documents) {
this.showWait();
let spec = {
spaceId: this.get('model.folder.id'),
data: documents,
@ -77,7 +75,7 @@ export default Controller.extend(NotifierMixin, {
this.get('documentSvc').export(spec).then((htmlExport) => {
this.get('browserSvc').downloadFile(htmlExport, this.get('model.folder.slug') + '.html');
this.showDone();
this.notifySuccess('Exported');
});
},

View file

@ -9,7 +9,26 @@
//
// https://documize.com
import Notifier from '../../mixins/notifier';
import Controller from '@ember/controller';
export default Controller.extend({
export default Controller.extend(Notifier, {
actions: {
onSuccess() {
this.notifySuccess('Saved');
},
onInfo() {
this.notifyInfo('Working');
},
onWarn() {
this.notifyWarn('Failed to get');
},
onError() {
this.notifyError('Unable to save changes');
}
}
});

View file

@ -6,6 +6,10 @@
<p>Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.</p>
{{/layout/master-sidebar}}
{{#layout/master-content}}
<button {{action 'onSuccess'}}>Success</button>
<button {{action 'onInfo'}}>Info</button>
<button {{action 'onWarn'}}>Warn</button>
<button {{action 'onError'}}>Error</button>
<p>Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.</p>
<p>Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.</p>
<p>Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.</p>