Cannot click on a item in search result

This commit is contained in:
Eugenio Romano
2016-08-30 16:16:31 +01:00
parent 684ddd27ff
commit ce191a9a23
13 changed files with 94 additions and 72 deletions

View File

@@ -16,13 +16,9 @@
*/
import { Component, EventEmitter, Output } from '@angular/core';
import { Router } from '@angular/router';
import { ALFRESCO_SEARCH_DIRECTIVES } from 'ng2-alfresco-search';
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer';
import {
AlfrescoAuthenticationService,
AlfrescoContentService
} from 'ng2-alfresco-core';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
declare let __moduleName: string;
@@ -30,48 +26,26 @@ declare let __moduleName: string;
moduleId: __moduleName,
selector: 'search-bar',
templateUrl: './search-bar.component.html',
styles: [`
`],
directives: [ ALFRESCO_SEARCH_DIRECTIVES, VIEWERCOMPONENT ]
directives: [ALFRESCO_SEARCH_DIRECTIVES, VIEWERCOMPONENT]
})
export class SearchBarComponent {
urlFile: string;
fileName: string;
mimeType: string;
fileNodeId: string;
fileShowed: boolean = false;
@Output()
expand = new EventEmitter();
constructor(
public router: Router,
public auth: AlfrescoAuthenticationService,
public contentService: AlfrescoContentService
) {
constructor(public auth: AlfrescoAuthenticationService) {
}
isLoggedIn(): boolean {
return this.auth.isLoggedIn();
}
/**
* Called when a new search term is submitted
*
* @param params Parameters relating to the search
*/
searchTermChange(params) {
this.router.navigate(['Search', {
q: params.value
}]);
}
onFileClicked(event) {
if (event.value.entry.isFile) {
this.fileName = event.value.entry.name;
this.mimeType = event.value.entry.content.mimeType;
this.urlFile = this.contentService.getContentUrl(event.value);
this.fileNodeId = event.value.entry.id;
this.fileShowed = true;
}
}

View File

@@ -3,6 +3,6 @@
<alfresco-search (preview)="onFileClicked($event)"></alfresco-search>
</div>
<alfresco-viewer [(showViewer)]="previewActive" [urlFile]="previewContentUrl" [fileName]="previewName" [mimeType]="previewMimeType" [overlayMode]="true">
<alfresco-viewer [(showViewer)]="fileShowed" [fileNodeId]="fileNodeId" [overlayMode]="true">
<div class="mdl-spinner mdl-js-spinner is-active"></div>
</alfresco-viewer>

View File

@@ -52,10 +52,7 @@ declare let __moduleName: string;
})
export class SearchComponent {
previewContentUrl: string;
previewName: string;
previewMimeType: string;
previewActive: boolean = false;
fileShowed: boolean = false;
fileNodeId: string;
constructor(public contentService: AlfrescoContentService) {
@@ -64,7 +61,7 @@ export class SearchComponent {
onFileClicked(event) {
if (event.value.entry.isFile) {
this.fileNodeId = event.value.entry.id;
this.previewActive = true;
this.fileShowed = true;
}
}
}