mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-506] Unify thumbnail service (#2014)
* move thumbnail service in core * fix folder
This commit is contained in:
committed by
Eugenio Romano
parent
f0ee0a2ee2
commit
87c1921034
@@ -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 {
|
||||
|
Reference in New Issue
Block a user