Load viewer on search results click

Refs #283
This commit is contained in:
Will Abson
2016-06-27 17:03:09 +01:00
parent 0bb77bbdad
commit a7d450c583
4 changed files with 49 additions and 10 deletions

View File

@@ -19,7 +19,7 @@
</thead>
<tbody>
<tr *ngFor="let result of results; let idx = index">
<tr *ngFor="let result of results; let idx = index" (click)="onItemClick(result, $event)">
<td><img src="{{getMimeTypeIcon(result)}}" /></td>
<td attr.data-automation-id=file_{{result.entry.name}} >{{result.entry.name}}</td>
<td attr.data-automation-id=file_{{result.entry.name}}_{{result.entry.modifiedByUser.displayName}}>

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, Optional, OnChanges, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, Output, Optional, OnChanges, OnInit } from '@angular/core';
import { RouteParams } from '@angular/router-deprecated';
import { AlfrescoSearchService } from './../services/alfresco-search.service';
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
@@ -38,6 +38,9 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
@Input()
searchTerm: string = '';
@Output()
preview: EventEmitter<any> = new EventEmitter();
results: any;
errorMessage;
@@ -100,4 +103,17 @@ export class AlfrescoSearchComponent implements OnChanges, OnInit {
}
}
onItemClick(node, event?: Event): void {
if (event) {
event.preventDefault();
}
if (node && node.entry) {
if (node.entry.isFile) {
this.preview.emit({
value: node
});
}
}
}
}