mirror of
https://github.com/documize/community.git
synced 2025-08-04 21:15:24 +02:00
implemented copy page facility
This commit is contained in:
parent
fc9127e165
commit
07ee2248d4
11 changed files with 269 additions and 18 deletions
|
@ -292,10 +292,39 @@ export default Ember.Service.extend({
|
|||
|
||||
// nuke an attachment
|
||||
deleteAttachment(documentId, attachmentId) {
|
||||
|
||||
return this.get('ajax').request(`documents/${documentId}/attachments/${attachmentId}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
},
|
||||
|
||||
//**************************************************
|
||||
// Page Move Copy
|
||||
//**************************************************
|
||||
|
||||
// Return list of documents that can accept a page.
|
||||
getPageMoveCopyTargets() {
|
||||
return this.get('ajax').request(`sections/targets`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
let data = [];
|
||||
|
||||
data = response.map((obj) => {
|
||||
let data = this.get('store').normalize('document', obj);
|
||||
return this.get('store').push(data);
|
||||
});
|
||||
|
||||
return data;
|
||||
});
|
||||
},
|
||||
|
||||
// Copy existing page to same or different document.
|
||||
copyPage(documentId, pageId, targetDocumentId) {
|
||||
return this.get('ajax').request(`documents/${documentId}/pages/${pageId}/copy/${targetDocumentId}`, {
|
||||
method: 'POST'
|
||||
}).then((response) => {
|
||||
let data = this.get('store').normalize('page', response);
|
||||
return this.get('store').push(data);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue