From 8f12c84b934a0393915964e0e4fc2a62c54aff26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 27 Feb 2020 11:49:44 +0100 Subject: [PATCH] MOBILE-3281 search: Show clear button on all glossaries --- .../components/index/addon-mod-glossary-index.html | 2 +- src/core/courses/pages/search/search.html | 2 +- src/core/courses/pages/search/search.ts | 12 ++++++++++++ src/core/search/components/search-box/search-box.ts | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html index 95f710bb1..4ab42f08d 100644 --- a/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html +++ b/src/addon/mod/glossary/components/index/addon-mod-glossary-index.html @@ -32,7 +32,7 @@ {{ 'core.hasdatatosync' | translate:{$a: moduleName} }} - + diff --git a/src/core/courses/pages/search/search.html b/src/core/courses/pages/search/search.html index cd5a1bd01..00475b3f9 100644 --- a/src/core/courses/pages/search/search.html +++ b/src/core/courses/pages/search/search.html @@ -4,7 +4,7 @@ - +
{{ 'core.courses.totalcoursesearchresults' | translate:{$a: total} }} diff --git a/src/core/courses/pages/search/search.ts b/src/core/courses/pages/search/search.ts index e3d56dcfb..e05a4a703 100644 --- a/src/core/courses/pages/search/search.ts +++ b/src/core/courses/pages/search/search.ts @@ -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. * diff --git a/src/core/search/components/search-box/search-box.ts b/src/core/search/components/search-box/search-box.ts index 5295790c5..2826043a1 100644 --- a/src/core/search/components/search-box/search-box.ts +++ b/src/core/search/components/search-box/search-box.ts @@ -117,7 +117,7 @@ export class CoreSearchBoxComponent implements OnInit, OnDestroy { */ protected async saveSearchToHistory(text: string): Promise { try { - await this.searchHistoryProvider.insertOrUpdateSearchText(this.searchArea, text); + await this.searchHistoryProvider.insertOrUpdateSearchText(this.searchArea, text.toLowerCase()); } finally { this.loadHistory(); }