-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new button in the navbar that opens a modal that help you search across the users. Implement query for searching across name, surname and username.
- Loading branch information
1 parent
d51b369
commit 07580d0
Showing
11 changed files
with
281 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
24 changes: 24 additions & 0 deletions
24
src/main/client/src/app/navbar/search-user/search-user.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title pull-left">Search users: </h4> | ||
<button type="button" class="close pull-right" aria-label="Close" (click)="close()"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
|
||
<label> | ||
Search for user: | ||
<input class="form-control" (keyup)="searchUser($event)"> | ||
</label> | ||
<hr> | ||
<div *ngFor="let user of users"> | ||
<div class="w3-container w3-card w3-white w3-round "> | ||
<img [src]="user.imagePath" alt="Avatar" class="w3-left w3-circle w3-margin-right" style="width:60px"> | ||
<h4><a (click)="close()" [routerLink]="['profile', user.username]">{{ user.displayName }} | ||
</a></h4> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="submit" class="btn btn-danger" (click)="close()">Close</button> | ||
</div> |
40 changes: 40 additions & 0 deletions
40
src/main/client/src/app/navbar/search-user/search-user.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {Component, OnInit} from '@angular/core'; | ||
import {BsModalRef} from "ngx-bootstrap"; | ||
import {Users} from "../../shared/user/user.model"; | ||
import {UserService} from "../../shared/user/user.service"; | ||
|
||
@Component({ | ||
selector: 'app-search-user', | ||
templateUrl: './search-user.component.html', | ||
styleUrls: ['./search-user.component.css'] | ||
}) | ||
export class SearchUserComponent implements OnInit { | ||
users: Users; | ||
|
||
constructor(public _modal: BsModalRef, | ||
private _userService: UserService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.users = []; | ||
} | ||
|
||
searchUser(event) { | ||
let term = event.target.value; | ||
if (term == '') { | ||
this.users = []; | ||
return; | ||
} | ||
this._userService.search(term) | ||
.then((users: Users) => { | ||
this.users = users; | ||
}); | ||
} | ||
|
||
close() { | ||
if (this._modal) { | ||
this._modal.hide(); | ||
this._modal = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.