mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1091] Destination picker is not completely translated [ADF-2000] (#186)
* [ACA-1091] Destination picker is not completely translated [ADF-2000] translate title taking into consideration also multiple selections for copy/move action * [ACA-1091] updated unit tests * [ACA-1091] removed translation to french as this will be added by the translation team and refactored title translation code
This commit is contained in:
committed by
Cilibiu Bogdan
parent
b28eabc63d
commit
34e322e9f6
@@ -27,7 +27,7 @@ import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
|
||||
import { AlfrescoApiService, ContentService, NodesApiService, DataColumn } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, ContentService, NodesApiService, DataColumn, TranslationService } from '@alfresco/adf-core';
|
||||
import { DocumentListService, ContentNodeSelectorComponent, ContentNodeSelectorComponentData } from '@alfresco/adf-content-services';
|
||||
import { MinimalNodeEntity, MinimalNodeEntryEntity, SitePaging } from 'alfresco-js-api';
|
||||
|
||||
@@ -44,7 +44,8 @@ export class NodeActionsService {
|
||||
private dialog: MatDialog,
|
||||
private documentListService: DocumentListService,
|
||||
private apiService: AlfrescoApiService,
|
||||
private nodesApi: NodesApiService) {}
|
||||
private nodesApi: NodesApiService,
|
||||
private translation: TranslationService) {}
|
||||
|
||||
/**
|
||||
* Copy node list
|
||||
@@ -175,11 +176,6 @@ export class NodeActionsService {
|
||||
getContentNodeSelection(action: string, contentEntities: MinimalNodeEntity[]): Subject<MinimalNodeEntryEntity[]> {
|
||||
const currentParentFolderId = this.getFirstParentId(contentEntities);
|
||||
|
||||
let nodeEntryName = '';
|
||||
if (contentEntities.length === 1 && contentEntities[0].entry.name) {
|
||||
nodeEntryName = `'${contentEntities[0].entry.name}' `;
|
||||
}
|
||||
|
||||
const customDropdown: SitePaging = {
|
||||
list: {
|
||||
entries: [
|
||||
@@ -199,8 +195,10 @@ export class NodeActionsService {
|
||||
}
|
||||
};
|
||||
|
||||
const title = this.getTitleTranslation(action, contentEntities);
|
||||
|
||||
const data: ContentNodeSelectorComponentData = {
|
||||
title: `${action} ${nodeEntryName}to ...`,
|
||||
title: title,
|
||||
currentFolderId: currentParentFolderId,
|
||||
actionName: action,
|
||||
dropdownHideMyFiles: true,
|
||||
@@ -238,6 +236,17 @@ export class NodeActionsService {
|
||||
return data.select;
|
||||
}
|
||||
|
||||
getTitleTranslation(action: string, nodes: MinimalNodeEntity[] = []): string {
|
||||
let keyPrefix = 'ITEMS';
|
||||
let name = '';
|
||||
|
||||
if (nodes.length === 1 && nodes[0].entry.name) {
|
||||
name = nodes[0].entry.name;
|
||||
keyPrefix = 'ITEM';
|
||||
}
|
||||
return this.translation.instant(`NODE_SELECTOR.${action.toUpperCase()}_${keyPrefix}`, {name});
|
||||
}
|
||||
|
||||
private hasEntityCreatePermission(entry: MinimalNodeEntryEntity): boolean {
|
||||
return this.contentService.hasPermission(entry, 'create');
|
||||
}
|
||||
|
Reference in New Issue
Block a user