mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ADF-2163] start refactoring folder dulpication action
This commit is contained in:
@@ -198,7 +198,7 @@
|
|||||||
<!-- folder actions -->
|
<!-- folder actions -->
|
||||||
<content-action
|
<content-action
|
||||||
icon="content_copy"
|
icon="content_copy"
|
||||||
target="all"
|
|
||||||
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.COPY' | translate}}"
|
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.COPY' | translate}}"
|
||||||
permission="update"
|
permission="update"
|
||||||
[disableWithNoPermission]="true"
|
[disableWithNoPermission]="true"
|
||||||
|
|||||||
+13
-11
@@ -84,7 +84,7 @@ export class ContentActionComponent implements OnInit, OnChanges {
|
|||||||
success = new EventEmitter();
|
success = new EventEmitter();
|
||||||
|
|
||||||
model: ContentActionModel;
|
model: ContentActionModel;
|
||||||
duplicateModel: ContentActionModel;
|
// duplicateModel: ContentActionModel;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private list: ContentActionListComponent,
|
private list: ContentActionListComponent,
|
||||||
@@ -102,15 +102,13 @@ export class ContentActionComponent implements OnInit, OnChanges {
|
|||||||
target: this.target,
|
target: this.target,
|
||||||
disabled: this.disabled
|
disabled: this.disabled
|
||||||
});
|
});
|
||||||
this.duplicateModel = null;
|
|
||||||
if (this.handler) {
|
if (this.handler) {
|
||||||
if(this.target === 'all') {
|
if (this.target === 'all') {
|
||||||
this.duplicateModel = Object.assign({}, this.model);
|
this.duplicateActionForFolder();
|
||||||
this.duplicateModel.handler = this.getSystemHandler('folder', this.handler);
|
|
||||||
this.duplicateModel.target = 'folder';
|
|
||||||
this.model.target = 'document';
|
this.model.target = 'document';
|
||||||
this.model.handler = this.getSystemHandler('document', this.handler);
|
this.model.handler = this.getSystemHandler('document', this.handler);
|
||||||
}else {
|
}else{
|
||||||
this.model.handler = this.getSystemHandler(this.target, this.handler);
|
this.model.handler = this.getSystemHandler(this.target, this.handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,9 +124,6 @@ export class ContentActionComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
register(): boolean {
|
register(): boolean {
|
||||||
if (this.list) {
|
if (this.list) {
|
||||||
if(this.target === 'all' ) {
|
|
||||||
this.list.registerAction(this.duplicateModel);
|
|
||||||
}
|
|
||||||
return this.list.registerAction(this.model);
|
return this.list.registerAction(this.model);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -139,6 +134,13 @@ export class ContentActionComponent implements OnInit, OnChanges {
|
|||||||
this.model.title = this.title;
|
this.model.title = this.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private duplicateActionForFolder() {
|
||||||
|
let folderActionModel = Object.assign({}, this.model);
|
||||||
|
folderActionModel.handler = this.getSystemHandler('folder', this.handler);
|
||||||
|
folderActionModel.target = 'folder';
|
||||||
|
this.list.registerAction(folderActionModel);
|
||||||
|
}
|
||||||
|
|
||||||
getSystemHandler(target: string, name: string): ContentActionHandler {
|
getSystemHandler(target: string, name: string): ContentActionHandler {
|
||||||
if (target) {
|
if (target) {
|
||||||
let ltarget = target.toLowerCase();
|
let ltarget = target.toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user