mirror of
https://github.com/documize/community.git
synced 2025-07-24 07:39:43 +02:00
More UI conversion to new framework
This commit is contained in:
parent
a453052087
commit
5d757c992f
17 changed files with 442 additions and 416 deletions
|
@ -9,9 +9,10 @@
|
|||
//
|
||||
// https://documize.com
|
||||
|
||||
import Controller from '@ember/controller';
|
||||
import { all } from 'rsvp';
|
||||
import { inject as service } from '@ember/service';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend(NotifierMixin, {
|
||||
documentService: service('document'),
|
||||
|
@ -19,6 +20,7 @@ export default Controller.extend(NotifierMixin, {
|
|||
localStorage: service('localStorage'),
|
||||
queryParams: ['category'],
|
||||
category: '',
|
||||
filteredDocs: null,
|
||||
|
||||
actions: {
|
||||
onAddSpace(payload) {
|
||||
|
@ -38,6 +40,53 @@ export default Controller.extend(NotifierMixin, {
|
|||
|
||||
onRefresh() {
|
||||
this.get('target._routerMicrolib').refresh();
|
||||
},
|
||||
|
||||
onMoveDocument(documents, targetSpaceId) {
|
||||
let self = this;
|
||||
let promises1 = [];
|
||||
let promises2 = [];
|
||||
|
||||
documents.forEach(function(documentId, index) {
|
||||
promises1[index] = self.get('documentService').getDocument(documentId);
|
||||
});
|
||||
|
||||
all(promises1).then(() => {
|
||||
promises1.forEach(function(doc, index) {
|
||||
doc.then((d) => {
|
||||
d.set('folderId', targetSpaceId);
|
||||
d.set('selected', false);
|
||||
promises2[index] = self.get('documentService').save(d);
|
||||
});
|
||||
});
|
||||
|
||||
all(promises2).then(() => {
|
||||
self.send('onRefresh');
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteDocument(documents) {
|
||||
let self = this;
|
||||
let promises = [];
|
||||
|
||||
documents.forEach(function (document, index) {
|
||||
promises[index] = self.get('documentService').deleteDocument(document);
|
||||
});
|
||||
|
||||
all(promises).then(() => {
|
||||
let documents = this.get('documents');
|
||||
documents.forEach(function (document) {
|
||||
document.set('selected', false);
|
||||
});
|
||||
|
||||
this.set('documents', documents);
|
||||
this.send('onRefresh');
|
||||
});
|
||||
},
|
||||
|
||||
onFiltered(docs) {
|
||||
this.set('filteredDocs', docs);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue