mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Restore navigation to search page in demo-shell
- Remove deprecated router component - searchChanges and new searchSubmit component outputs work as you would expect - Update tests Refs #737
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<alfresco-search-control *ngIf="isLoggedIn()" [searchTerm]="searchTerm" [autocomplete]="false"
|
||||
(searchChange)="searchTermChange($event);" (expand)="onExpandToggle($event);" (preview)="onFileClicked($event)"></alfresco-search-control>
|
||||
(searchSubmit)="onSearchSubmit($event);" (searchChange)="onSearchTermChange($event);" (expand)="onExpandToggle($event);" (preview)="onFileClicked($event)"></alfresco-search-control>
|
||||
|
||||
<alfresco-viewer [(showViewer)]="fileShowed"
|
||||
[fileNodeId]="fileNodeId"
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Output } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
|
||||
declare let __moduleName: string;
|
||||
@@ -34,13 +35,25 @@ export class SearchBarComponent {
|
||||
@Output()
|
||||
expand = new EventEmitter();
|
||||
|
||||
constructor(public auth: AlfrescoAuthenticationService) {
|
||||
constructor(public router: Router,
|
||||
public auth: AlfrescoAuthenticationService) {
|
||||
}
|
||||
|
||||
isLoggedIn(): boolean {
|
||||
return this.auth.isLoggedIn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user submits the search, e.g. hits enter or clicks submit
|
||||
*
|
||||
* @param event Parameters relating to the search
|
||||
*/
|
||||
onSearchSubmit(event) {
|
||||
this.router.navigate(['/search', {
|
||||
q: event.value
|
||||
}]);
|
||||
}
|
||||
|
||||
onFileClicked(event) {
|
||||
if (event.value.entry.isFile) {
|
||||
this.fileNodeId = event.value.entry.id;
|
||||
@@ -48,8 +61,7 @@ export class SearchBarComponent {
|
||||
}
|
||||
}
|
||||
|
||||
searchTermChange(event) {
|
||||
console.log('Search term changed', event);
|
||||
onSearchTermChange(event) {
|
||||
this.searchTerm = event.value;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user