[ADF-506] Unify thumbnail service (#2014)

* move thumbnail service in core

* fix folder
This commit is contained in:
Eugenio Romano
2017-07-06 10:43:13 +02:00
committed by Eugenio Romano
parent f0ee0a2ee2
commit 87c1921034
72 changed files with 477 additions and 3926 deletions

View File

@@ -19,7 +19,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, OnChanges, Output,
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { AlfrescoSearchService, SearchOptions } from './../services/alfresco-search.service';
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
import { ThumbnailService } from 'ng2-alfresco-core';
declare var require: any;
@@ -71,7 +71,7 @@ export class AlfrescoSearchAutocompleteComponent implements OnInit, OnChanges {
constructor(private searchService: AlfrescoSearchService,
private translateService: AlfrescoTranslationService,
private thumbnailService: AlfrescoThumbnailService) {
private thumbnailService: ThumbnailService) {
}
ngOnInit(): void {
@@ -124,30 +124,16 @@ export class AlfrescoSearchAutocompleteComponent implements OnInit, OnChanges {
* @returns {string} URL address.
*/
getMimeTypeIcon(node: MinimalNodeEntity): string {
let mimeType;
if (node.entry.content && node.entry.content.mimeType) {
let icon = this.thumbnailService.getMimeTypeIcon(node.entry.content.mimeType);
return this.resolveIconPath(icon);
mimeType = node.entry.content.mimeType;
}
if (node.entry.isFolder) {
return require('../assets/images/ft_ic_folder.svg');
mimeType = 'folder';
}
}
resolveIconPath(icon: string): string {
return require('../assets/images/' + icon);
}
/**
* Gets thumbnail message key for the given document node, which can be used to look up alt text
* @param node Node to get URL for.
* @returns {string} URL address.
*/
getMimeTypeKey(node: MinimalNodeEntity): string {
if (node.entry.content && node.entry.content.mimeType) {
return 'SEARCH.ICONS.' + this.thumbnailService.getMimeTypeKey(node.entry.content.mimeType);
} else {
return '';
}
return this.thumbnailService.getMimeTypeIcon(mimeType);
}
focusResult(): void {