[ADF-2163] first step to target all

This commit is contained in:
VitoAlbano
2018-02-01 10:12:09 +00:00
parent 102656582c
commit 495b8c5185
2 changed files with 31 additions and 18 deletions
@@ -198,7 +198,7 @@
<!-- folder actions -->
<content-action
icon="content_copy"
target="folder"
target="all"
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.COPY' | translate}}"
permission="update"
[disableWithNoPermission]="true"
@@ -206,6 +206,16 @@
(success)="onContentActionSuccess($event)"
handler="copy">
</content-action>
<!-- <content-action
icon="content_copy"
target="document"
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.COPY' | translate}}"
permission="update"
[disableWithNoPermission]="true"
(error)="onContentActionError($event)"
(success)="onContentActionSuccess($event)"
handler="copy">
</content-action> -->
<content-action
icon="redo"
target="folder"
@@ -227,16 +237,7 @@
handler="delete">
</content-action>
<!-- document actions -->
<content-action
icon="content_copy"
target="document"
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.COPY' | translate}}"
permission="update"
[disableWithNoPermission]="true"
(error)="onContentActionError($event)"
(success)="onContentActionSuccess($event)"
handler="copy">
</content-action>
<content-action
icon="redo"
target="document"
@@ -49,7 +49,7 @@ export class ContentActionComponent implements OnInit, OnChanges {
/** Type of item that the action appies to. Can be "document" or "folder" */
@Input()
target: string;
target: string = 'all';
/** The permission type. */
@Input()
@@ -84,6 +84,7 @@ export class ContentActionComponent implements OnInit, OnChanges {
success = new EventEmitter();
model: ContentActionModel;
duplicateModel: ContentActionModel;
constructor(
private list: ContentActionListComponent,
@@ -101,9 +102,17 @@ export class ContentActionComponent implements OnInit, OnChanges {
target: this.target,
disabled: this.disabled
});
this.duplicateModel = null;
if (this.handler) {
this.model.handler = this.getSystemHandler(this.target, this.handler);
if(this.target === 'all') {
this.duplicateModel = Object.assign({}, this.model);
this.duplicateModel.handler = this.getSystemHandler('folder', this.handler);
this.duplicateModel.target = 'folder';
this.model.target = 'document';
this.model.handler = this.getSystemHandler('document', this.handler);
}else {
this.model.handler = this.getSystemHandler(this.target, this.handler);
}
}
if (this.execute) {
@@ -117,6 +126,9 @@ export class ContentActionComponent implements OnInit, OnChanges {
register(): boolean {
if (this.list) {
if(this.target === 'all' ) {
this.list.registerAction(this.duplicateModel);
}
return this.list.registerAction(this.model);
}
return false;
@@ -133,8 +145,8 @@ export class ContentActionComponent implements OnInit, OnChanges {
if (ltarget === 'document') {
if (this.documentActions) {
this.documentActions.permissionEvent.subscribe((permision) => {
this.permissionEvent.emit(permision);
this.documentActions.permissionEvent.subscribe((permission) => {
this.permissionEvent.emit(permission);
});
this.documentActions.error.subscribe((errors) => {
@@ -152,8 +164,8 @@ export class ContentActionComponent implements OnInit, OnChanges {
if (ltarget === 'folder') {
if (this.folderActions) {
this.folderActions.permissionEvent.subscribe((permision) => {
this.permissionEvent.emit(permision);
this.folderActions.permissionEvent.subscribe((permission) => {
this.permissionEvent.emit(permission);
});
this.folderActions.error.subscribe((errors) => {