mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
Provide copy document option
Duplicates entire document tree into a new document (same space).
This commit is contained in:
parent
b75969ae90
commit
ec8d5c78e2
10 changed files with 304 additions and 12 deletions
|
@ -48,6 +48,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
|||
this.get('permissions.documentEdit')) return true;
|
||||
|
||||
}),
|
||||
duplicateName: '',
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
@ -57,7 +58,7 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
|||
pinId: '',
|
||||
newName: ''
|
||||
};
|
||||
|
||||
|
||||
this.saveTemplate = {
|
||||
name: '',
|
||||
description: ''
|
||||
|
@ -88,6 +89,10 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
|||
this.modalOpen("#document-template-modal", {show:true}, "#new-template-name");
|
||||
},
|
||||
|
||||
onShowDuplicateModal() {
|
||||
this.modalOpen("#document-duplicate-modal", {show:true}, "#duplicate-name");
|
||||
},
|
||||
|
||||
onShowDeleteModal() {
|
||||
this.modalOpen("#document-delete-modal", {show:true});
|
||||
},
|
||||
|
@ -183,6 +188,25 @@ export default Component.extend(ModalMixin, AuthMixin, Notifier, {
|
|||
return true;
|
||||
},
|
||||
|
||||
onDuplicate() {
|
||||
let name = this.get('duplicateName');
|
||||
|
||||
if (_.isEmpty(name)) {
|
||||
$("#duplicate-name").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
$("#duplicate-name").removeClass("is-invalid");
|
||||
|
||||
this.set('duplicateName', '');
|
||||
|
||||
this.get('onDuplicate')(name);
|
||||
|
||||
this.modalClose('#document-duplicate-modal');
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onExport() {
|
||||
let spec = {
|
||||
spaceId: this.get('document.spaceId'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue