From c070ba5e42d7b470348c8e355f3734dab7380fa7 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 5 Oct 2023 16:41:18 +0200 Subject: [PATCH 1/3] MOBILE-3371 search: Improve styles for long items --- src/core/components/mod-icon/mod-icon.scss | 6 +++ .../global-search-result.html | 2 +- .../global-search-result.scss | 37 +++++++++++++------ .../stories/components/components.module.ts | 2 - .../global-search-results-page.ts | 20 ++++++++++ 5 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/core/components/mod-icon/mod-icon.scss b/src/core/components/mod-icon/mod-icon.scss index 8a6085ae4..d8a742862 100644 --- a/src/core/components/mod-icon/mod-icon.scss +++ b/src/core/components/mod-icon/mod-icon.scss @@ -27,6 +27,12 @@ } } + &.other { + img { + filter: var(--filter); + } + } + } img { diff --git a/src/core/features/search/components/global-search-result/global-search-result.html b/src/core/features/search/components/global-search-result/global-search-result.html index 46c186d82..dfb49fe48 100644 --- a/src/core/features/search/components/global-search-result/global-search-result.html +++ b/src/core/features/search/components/global-search-result/global-search-result.html @@ -11,7 +11,7 @@ -
+
diff --git a/src/core/features/search/components/global-search-result/global-search-result.scss b/src/core/features/search/components/global-search-result/global-search-result.scss index 566a5a56d..824d1823c 100644 --- a/src/core/features/search/components/global-search-result/global-search-result.scss +++ b/src/core/features/search/components/global-search-result/global-search-result.scss @@ -21,6 +21,7 @@ margin-bottom: 0px; --padding: 0px; background: transparent; + flex-shrink: 0; } ion-icon, .result-icon { @@ -28,6 +29,7 @@ height: var(--core-global-search-result-icon-size); margin-inline-end: var(--spacing-2); + flex-shrink: 0; } } @@ -61,20 +63,33 @@ } - .result-context { + .result-context-wrapper { display: flex; - justify-items: center; - align-items: center; - color: var(--core-global-search-result-context-color); - margin-top: var(--spacing-2); - font-size: 12px; + flex-wrap: wrap; + flex-direction: row; - ion-icon { - margin-inline-end: var(--spacing-1); - } + .result-context { + display: flex; + justify-items: center; + align-items: center; + color: var(--core-global-search-result-context-color); + margin-top: var(--spacing-2); + margin-inline-end: var(--spacing-4); + font-size: 12px; + + ion-icon { + margin-inline-end: var(--spacing-1); + flex-shrink: 0; + } + + core-format-text { + color: var(--core-global-search-result-context-color); + } + + span { + white-space: normal; + } - + .result-context { - margin-inline-start: var(--spacing-4); } } diff --git a/src/core/features/search/stories/components/components.module.ts b/src/core/features/search/stories/components/components.module.ts index bfece68ca..1e59da784 100644 --- a/src/core/features/search/stories/components/components.module.ts +++ b/src/core/features/search/stories/components/components.module.ts @@ -20,13 +20,11 @@ import { CommonModule } from '@angular/common'; import { CoreSearchGlobalSearchResultsPageComponent, } from '@features/search/stories/components/global-search-results-page/global-search-results-page'; -import { CoreSearchGlobalSearchResultComponent } from '@features/search/components/global-search-result/global-search-result'; import { CoreSharedModule } from '@/core/shared.module'; @NgModule({ declarations: [ CoreSearchGlobalSearchResultsPageComponent, - CoreSearchGlobalSearchResultComponent, ], imports: [ CoreSharedModule, diff --git a/src/core/features/search/stories/components/global-search-results-page/global-search-results-page.ts b/src/core/features/search/stories/components/global-search-results-page/global-search-results-page.ts index 8e4dd3dd3..6154c5d22 100644 --- a/src/core/features/search/stories/components/global-search-results-page/global-search-results-page.ts +++ b/src/core/features/search/stories/components/global-search-results-page/global-search-results-page.ts @@ -107,6 +107,26 @@ export class CoreSearchGlobalSearchResultsPageComponent { iconurl: 'https://master.mm.moodledemo.net/theme/image.php?theme=boost&component=core&image=i%2Fsection', }, }, + { + id: 8, + url: '', + title: 'This item has long text everywhere, so make sure that it looks good anyways. ' + + 'Even if the screen you\'re using is also big, this should still be a problem because this text is *really* long.', + content: 'You would normally see lorem ipsum here, but we decided to just write some gibberish here to make it more ' + + 'real. We all know that lorem ipsum is fabricated text, and even though it serves its purpose, it isn\'t as ' + + 'engaging as some real, hand-crafted text (not sure why this should be engaging, anyways).', + context: { + courseName: 'And it\'s not just the title, either. Other things like the Course title also take more than ' + + 'you would expect in a normal site (or even not so normal).', + userName: 'To top it off, it has a user name as well! What is this madness? Well, at some point you just have to ' + + 'get creative. Honestly, I\'m surprised if you\'re even reading this. Kudos to you for being thorough.', + }, + module: { + name: 'book', + iconurl: 'assets/img/mod/book.svg', + area: '', + }, + }, ]; /** From 9b04cda8972629c6fef0eb2dc42ce1088b632e11 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 5 Oct 2023 16:41:37 +0200 Subject: [PATCH 2/3] MOBILE-3371 search: Fix disabled feature --- src/core/features/search/services/global-search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/features/search/services/global-search.ts b/src/core/features/search/services/global-search.ts index b7728e195..33f553ff7 100644 --- a/src/core/features/search/services/global-search.ts +++ b/src/core/features/search/services/global-search.ts @@ -101,7 +101,7 @@ export class CoreSearchGlobalSearchService { ? await CoreSites.getSite(siteId) : CoreSites.getRequiredCurrentSite(); - return !site?.isFeatureDisabled('CoreNoDelegate_GlobalSearch') + return !site?.isFeatureDisabled('NoDelegate_GlobalSearch') && site?.wsAvailable('core_search_get_results') // @since 4.3 && site?.canUseAdvancedFeature('enableglobalsearch'); } From 0474d694e7437e46abc713f63c656e2690c6137f Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 5 Oct 2023 17:46:15 +0200 Subject: [PATCH 3/3] MOBILE-3371 search: Remove search results count Given some issues with the LMS webservices (they return inconsistent totalcount depending on the page), we've decided to remove this information from the UI to avoid confusion. --- scripts/langindex.json | 1 - src/addons/mod/forum/lang.json | 1 - src/addons/mod/forum/pages/search/search.html | 4 ---- src/addons/mod/forum/tests/behat/search.feature | 3 +-- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 2ad44374b..5233adbf0 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -685,7 +685,6 @@ "addon.mod_forum.removefromfavourites": "forum", "addon.mod_forum.reply": "forum", "addon.mod_forum.replyplaceholder": "forum", - "addon.mod_forum.searchresults": "course", "addon.mod_forum.subject": "forum", "addon.mod_forum.tagarea_forum_posts": "forum", "addon.mod_forum.thisforumhasduedate": "forum", diff --git a/src/addons/mod/forum/lang.json b/src/addons/mod/forum/lang.json index 42c33b92a..46277f2df 100644 --- a/src/addons/mod/forum/lang.json +++ b/src/addons/mod/forum/lang.json @@ -59,7 +59,6 @@ "removefromfavourites": "Unstar this discussion", "reply": "Reply", "replyplaceholder": "Write your reply...", - "searchresults": "Search results: {{$a}}", "subject": "Subject", "tagarea_forum_posts": "Forum posts", "thisforumhasduedate": "The due date for posting to this forum is {{$a}}.", diff --git a/src/addons/mod/forum/pages/search/search.html b/src/addons/mod/forum/pages/search/search.html index 24274aa3c..c33244429 100644 --- a/src/addons/mod/forum/pages/search/search.html +++ b/src/addons/mod/forum/pages/search/search.html @@ -23,10 +23,6 @@ -
- {{ 'addon.mod_forum.searchresults' | translate: { $a: resultsSource.getTotalResults() } }} -
- diff --git a/src/addons/mod/forum/tests/behat/search.feature b/src/addons/mod/forum/tests/behat/search.feature index f9cde8dc2..b6471d5d3 100644 --- a/src/addons/mod/forum/tests/behat/search.feature +++ b/src/addons/mod/forum/tests/behat/search.feature @@ -46,6 +46,5 @@ Feature: Test Forum Search When I set the field "Search" to "message" in the app And I press "Search" "button" in the app - Then I should find "Search results: 2" in the app - And I should find "Test forum 1" in the app + Then I should find "Test forum 1" in the app And I should find "Test forum 2" in the app