Merge pull request #2292 from crazyserver/MOBILE-3281
MOBILE-3281 search: Show clear button on all glossariesmain
commit
29779f0c4f
|
@ -32,7 +32,7 @@
|
||||||
<ion-icon name="warning"></ion-icon> {{ 'core.hasdatatosync' | translate:{$a: moduleName} }}
|
<ion-icon name="warning"></ion-icon> {{ 'core.hasdatatosync' | translate:{$a: moduleName} }}
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
<core-search-box *ngIf="isSearch" (onSubmit)="search($event)" [placeholder]="'addon.mod_glossary.searchquery' | translate" [autoFocus]="true" [lengthCheck]="2" [showClear]="false" searchArea="AddonModGlossary-{{module.id}}"></core-search-box>
|
<core-search-box *ngIf="isSearch" (onSubmit)="search($event)" [placeholder]="'addon.mod_glossary.searchquery' | translate" [autoFocus]="true" [lengthCheck]="2" (onClear)="toggleSearch($event)" searchArea="AddonModGlossary-{{module.id}}"></core-search-box>
|
||||||
|
|
||||||
<core-loading [hideUntil]="loaded" class="core-loading-center">
|
<core-loading [hideUntil]="loaded" class="core-loading-center">
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<core-search-box (onSubmit)="search($event)" [placeholder]="'core.courses.search' | translate" [searchLabel]="'core.courses.search' | translate" autoFocus="true" showClear="false" searchArea="CoreCoursesSearch"></core-search-box>
|
<core-search-box (onSubmit)="search($event)" (onClear)="clearSearch($event)" [placeholder]="'core.courses.search' | translate" [searchLabel]="'core.courses.search' | translate" autoFocus="true" searchArea="CoreCoursesSearch"></core-search-box>
|
||||||
|
|
||||||
<div *ngIf="courses">
|
<div *ngIf="courses">
|
||||||
<ion-item-divider>{{ 'core.courses.totalcoursesearchresults' | translate:{$a: total} }}</ion-item-divider>
|
<ion-item-divider>{{ 'core.courses.totalcoursesearchresults' | translate:{$a: total} }}</ion-item-divider>
|
||||||
|
|
|
@ -52,6 +52,18 @@ export class CoreCoursesSearchPage {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear search box.
|
||||||
|
*
|
||||||
|
* @param e The event object.
|
||||||
|
*/
|
||||||
|
clearSearch(e: Event): void {
|
||||||
|
this.currentSearch = '';
|
||||||
|
this.courses = undefined;
|
||||||
|
this.page = 0;
|
||||||
|
this.total = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load more results.
|
* Load more results.
|
||||||
*
|
*
|
||||||
|
|
|
@ -117,7 +117,7 @@ export class CoreSearchBoxComponent implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
protected async saveSearchToHistory(text: string): Promise<void> {
|
protected async saveSearchToHistory(text: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await this.searchHistoryProvider.insertOrUpdateSearchText(this.searchArea, text);
|
await this.searchHistoryProvider.insertOrUpdateSearchText(this.searchArea, text.toLowerCase());
|
||||||
} finally {
|
} finally {
|
||||||
this.loadHistory();
|
this.loadHistory();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue