[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 --> <!-- folder actions -->
<content-action <content-action
icon="content_copy" icon="content_copy"
target="folder" target="all"
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.COPY' | translate}}" title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.COPY' | translate}}"
permission="update" permission="update"
[disableWithNoPermission]="true" [disableWithNoPermission]="true"
@@ -206,6 +206,16 @@
(success)="onContentActionSuccess($event)" (success)="onContentActionSuccess($event)"
handler="copy"> handler="copy">
</content-action> </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 <content-action
icon="redo" icon="redo"
target="folder" target="folder"
@@ -227,16 +237,7 @@
handler="delete"> handler="delete">
</content-action> </content-action>
<!-- document actions --> <!-- 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 <content-action
icon="redo" icon="redo"
target="document" 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" */ /** Type of item that the action appies to. Can be "document" or "folder" */
@Input() @Input()
target: string; target: string = 'all';
/** The permission type. */ /** The permission type. */
@Input() @Input()
@@ -84,6 +84,7 @@ export class ContentActionComponent implements OnInit, OnChanges {
success = new EventEmitter(); success = new EventEmitter();
model: ContentActionModel; model: ContentActionModel;
duplicateModel: ContentActionModel;
constructor( constructor(
private list: ContentActionListComponent, private list: ContentActionListComponent,
@@ -101,9 +102,17 @@ 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) {
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) { if (this.execute) {
@@ -117,6 +126,9 @@ 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;
@@ -133,8 +145,8 @@ export class ContentActionComponent implements OnInit, OnChanges {
if (ltarget === 'document') { if (ltarget === 'document') {
if (this.documentActions) { if (this.documentActions) {
this.documentActions.permissionEvent.subscribe((permision) => { this.documentActions.permissionEvent.subscribe((permission) => {
this.permissionEvent.emit(permision); this.permissionEvent.emit(permission);
}); });
this.documentActions.error.subscribe((errors) => { this.documentActions.error.subscribe((errors) => {
@@ -152,8 +164,8 @@ export class ContentActionComponent implements OnInit, OnChanges {
if (ltarget === 'folder') { if (ltarget === 'folder') {
if (this.folderActions) { if (this.folderActions) {
this.folderActions.permissionEvent.subscribe((permision) => { this.folderActions.permissionEvent.subscribe((permission) => {
this.permissionEvent.emit(permision); this.permissionEvent.emit(permission);
}); });
this.folderActions.error.subscribe((errors) => { this.folderActions.error.subscribe((errors) => {