From fd989585101bba8d46c5d9f93b9d58f50b532e35 Mon Sep 17 00:00:00 2001 From: "michael.breu" <michael.breu@uibk.ac.at> Date: Fri, 26 Feb 2021 09:47:00 +0100 Subject: [PATCH] Teasers werden jetzt verlinkt. --- .../teaserContent.component.html | 6 ++--- .../teaserContent/teaserContent.component.ts | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/app/teaserContent/teaserContent.component.html b/src/main/webapp/app/teaserContent/teaserContent.component.html index 898cf752d..8c014ad99 100644 --- a/src/main/webapp/app/teaserContent/teaserContent.component.html +++ b/src/main/webapp/app/teaserContent/teaserContent.component.html @@ -3,19 +3,19 @@ <div class="col-sm-3"> <p style="padding-left: 30px;"><strong>Keywords</strong></p> <ul style="list-style-type: circle;"> - <li *ngFor="let keyWord of keywords"><a href="#">{{keyWord}}</a></li> + <li *ngFor="let keyWord of keywords"><a (click)="clickKeyword(keyWord)">{{keyWord}}</a></li> </ul> </div> <div class="col-sm-3"> <p style="padding-left: 30px;"><strong>Programming Languages</strong></p> <ul style="list-style-type: circle;"> - <li *ngFor="let programmingLanguage of programmingLanguages"><a href="#">{{programmingLanguage}}</a></li> + <li *ngFor="let programmingLanguage of programmingLanguages"><a (click)="clickLanguage(programmingLanguage)">{{programmingLanguage}}</a></li> </ul> </div> <div class="col-sm-3"> <p style="padding-left: 30px;"><strong>Contributors</strong></p> <ul style="list-style-type: circle;"> - <li *ngFor="let contributor of contributors"><a href="#">{{contributor}}</a></li> + <li *ngFor="let contributor of contributors"><a (click)="clickContributor(contributor)">{{contributor}}</a></li> </ul> </div> </div> \ No newline at end of file diff --git a/src/main/webapp/app/teaserContent/teaserContent.component.ts b/src/main/webapp/app/teaserContent/teaserContent.component.ts index d122693d8..5740293cd 100644 --- a/src/main/webapp/app/teaserContent/teaserContent.component.ts +++ b/src/main/webapp/app/teaserContent/teaserContent.component.ts @@ -1,18 +1,26 @@ import { Component, OnInit } from '@angular/core'; import { SearchService } from 'app/search/service/search-service'; +import {SearchInputComponent} from 'app/search-input/search-input.component' + +import { Router } from '@angular/router'; + @Component({ selector: 'jhi-teaser-content', templateUrl: './teaserContent.component.html', styleUrls: ['./teaserContent.component.scss'], + providers: [SearchInputComponent] }) export class TeaserContentComponent implements OnInit { public keywords: Array<String> = new Array<String>(); public contributors: Array<String> = new Array<String>(); public programmingLanguages: Array<String> = new Array<String>(); - constructor(private searchService: SearchService) {} + constructor( + private searchService: SearchService, + private router: Router, + private searchInputComponent: SearchInputComponent) {} ngOnInit(): void { this.searchService.getKeywordsAutoComplete('').subscribe( @@ -41,4 +49,16 @@ export class TeaserContentComponent implements OnInit { } ); } + + clickLanguage(programmingLanguage: String): void { + this.router.navigate(['/search'], { queryParams: { pl: programmingLanguage } }); + } + + clickContributor(contributor: String): void { + this.router.navigate(['/search'], { queryParams: { a: contributor } }); + } + + clickKeyword(keyWord: String): void { + this.router.navigate(['/search'], { queryParams: { kw: keyWord } }); + } } -- GitLab