diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-04 16:44:53 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2020-02-13 16:35:24 +0100 |
commit | 9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110 (patch) | |
tree | f38e6f83a9d892a99f930c0a25b1a405e679cd4a /client/src/app/header/search-typeahead.component.html | |
parent | ece3029bd99a76b3c48a1cc8c58914c5cf61f106 (diff) | |
download | PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.gz PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.tar.zst PeerTube-9b8a7aa8ea128f7e197ff38ca9f86ffa53bbe110.zip |
Improve search typeahead performance and use native events
Diffstat (limited to 'client/src/app/header/search-typeahead.component.html')
-rw-r--r-- | client/src/app/header/search-typeahead.component.html | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/client/src/app/header/search-typeahead.component.html b/client/src/app/header/search-typeahead.component.html index 2623ba337..428246585 100644 --- a/client/src/app/header/search-typeahead.component.html +++ b/client/src/app/header/search-typeahead.component.html | |||
@@ -1,9 +1,13 @@ | |||
1 | <div class="d-inline-flex position-relative" id="typeahead-container" #contentWrapper> | 1 | <div class="d-inline-flex position-relative" id="typeahead-container"> |
2 | <ng-content></ng-content> | 2 | <input |
3 | type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…" | ||
4 | [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKeyUp($event)" | ||
5 | > | ||
6 | <span class="icon icon-search" (click)="doSearch()"></span> | ||
3 | 7 | ||
4 | <div class="position-absolute jump-to-suggestions"> | 8 | <div class="position-absolute jump-to-suggestions"> |
5 | <!-- suggestions --> | 9 | <!-- suggestions --> |
6 | <my-suggestions *ngIf="hasSearch && newSearch" [results]="results" [highlight]="searchInput.value" (init)="initKeyboardEventsManager($event)" #suggestions></my-suggestions> | 10 | <my-suggestions *ngIf="search && newSearch" [results]="results" [highlight]="search" (init)="initKeyboardEventsManager($event)"></my-suggestions> |
7 | 11 | ||
8 | <!-- suggestion help, not shown until one of the suggestions is selected and specific to that suggestion --> | 12 | <!-- suggestion help, not shown until one of the suggestions is selected and specific to that suggestion --> |
9 | <div *ngIf="showHelp" id="typeahead-help" class="overflow-hidden"> | 13 | <div *ngIf="showHelp" id="typeahead-help" class="overflow-hidden"> |
@@ -11,7 +15,7 @@ | |||
11 | <div class="d-flex justify-content-between"> | 15 | <div class="d-flex justify-content-between"> |
12 | <label class="small-title" i18n>Global search</label> | 16 | <label class="small-title" i18n>Global search</label> |
13 | <div class="advanced-search-status text-muted"> | 17 | <div class="advanced-search-status text-muted"> |
14 | <span class="mr-1" i18n>using {{ globalSearchIndex }}</span> | 18 | <span *ngIf="serverConfig" class="mr-1" i18n>using {{ serverConfig.followings.instance.autoFollowIndex.indexUrl }}</span> |
15 | <i class="glyphicon glyphicon-globe"></i> | 19 | <i class="glyphicon glyphicon-globe"></i> |
16 | </div> | 20 | </div> |
17 | </div> | 21 | </div> |
@@ -20,13 +24,14 @@ | |||
20 | </div> | 24 | </div> |
21 | 25 | ||
22 | <!-- search instructions, when search input is empty --> | 26 | <!-- search instructions, when search input is empty --> |
23 | <div *ngIf="!hasSearch" id="typeahead-instructions" class="overflow-hidden"> | 27 | <div *ngIf="showInstructions" id="typeahead-instructions" class="overflow-hidden"> |
24 | <div class="d-flex justify-content-between"> | 28 | <div class="d-flex justify-content-between"> |
25 | <label class="small-title" i18n>Advanced search</label> | 29 | <label class="small-title" i18n>Advanced search</label> |
26 | <div class="advanced-search-status c-help"> | 30 | <div class="advanced-search-status c-help"> |
27 | <span [ngClass]="URIPolicy === 'any' ? 'text-success' : 'text-muted'" [title]="URIPolicyText"> | 31 | <span [ngClass]="anyURI ? 'text-success' : 'text-muted'" i18n-title title="Determines whether you can resolve any distant content, or if this instance only allows doing so for instances it follows."> |
28 | <span class="mr-1" i18n>{URIPolicy, select, only-followed {only followed instances} other {any instance}} </span> | 32 | <span *ngIf="anyURI" class="mr-1" i18n>any instance</span> |
29 | <i [ngClass]="URIPolicy === 'any' ? 'glyphicon glyphicon-ok-sign' : 'glyphicon glyphicon-exclamation-sign'"></i> | 33 | <span *ngIf="!anyURI" class="mr-1" i18n>only followed instances</span> |
34 | <i [ngClass]="anyURI ? 'glyphicon glyphicon-ok-sign' : 'glyphicon glyphicon-exclamation-sign'"></i> | ||
30 | </span> | 35 | </span> |
31 | </div> | 36 | </div> |
32 | </div> | 37 | </div> |