mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Cannot click on a item in search result
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user