mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Allow navigation to folders from search results (#1209)
* Allow navigation to folders from search results - Uses router to pass ID of the folder - Modified document list component to accept folder ID without path - Current limitations - Breadcrumb cannot currently be shown when navigating via folder id - Clicking between folders does not update the current route * Allow root folder ID to be changed and have documentlist reload - e.g switching from Company home to My Files * New tests for navigating to folders based on ID Refs #666
This commit is contained in:
@@ -20,6 +20,7 @@ import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { AlfrescoSearchService, SearchOptions } from './../services/alfresco-search.service';
|
||||
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
@@ -29,6 +30,9 @@ import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
})
|
||||
export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
|
||||
static SINGLE_CLICK_NAVIGATION: string = 'click';
|
||||
static DOUBLE_CLICK_NAVIGATION: string = 'dblclick';
|
||||
|
||||
@Input()
|
||||
searchTerm: string = '';
|
||||
|
||||
@@ -44,8 +48,11 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
@Input()
|
||||
resultType: string = null;
|
||||
|
||||
@Input()
|
||||
navigationMode: string = AlfrescoSearchComponent.DOUBLE_CLICK_NAVIGATION; // click|dblclick
|
||||
|
||||
@Output()
|
||||
preview: EventEmitter<any> = new EventEmitter();
|
||||
navigate: EventEmitter<MinimalNodeEntity> = new EventEmitter<MinimalNodeEntity>();
|
||||
|
||||
@Output()
|
||||
resultsLoad = new EventEmitter();
|
||||
@@ -92,6 +99,8 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
if (node.entry.content && node.entry.content.mimeType) {
|
||||
let icon = this._alfrescoThumbnailService.getMimeTypeIcon(node.entry.content.mimeType);
|
||||
return this.resolveIconPath(icon);
|
||||
} else if (node.entry.isFolder) {
|
||||
return 'ft_ic_folder.svg';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,14 +163,17 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
|
||||
}
|
||||
|
||||
onItemClick(node, event?: Event): void {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
if (this.navigate && this.navigationMode === AlfrescoSearchComponent.SINGLE_CLICK_NAVIGATION) {
|
||||
if (node && node.entry) {
|
||||
this.navigate.emit(node);
|
||||
}
|
||||
}
|
||||
if (node && node.entry) {
|
||||
if (node.entry.isFile) {
|
||||
this.preview.emit({
|
||||
value: node
|
||||
});
|
||||
}
|
||||
|
||||
onItemDblClick(node: MinimalNodeEntity) {
|
||||
if (this.navigate && this.navigationMode === AlfrescoSearchComponent.DOUBLE_CLICK_NAVIGATION) {
|
||||
if (node && node.entry) {
|
||||
this.navigate.emit(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user