From 2ce808dfab550ec0ed35deed785baf1a3550a0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 31 Mar 2022 16:53:24 +0200 Subject: [PATCH] MOBILE-3833 my: Move search to empty box on my overview --- .../myoverview/addon-block-myoverview.html | 5 +++++ .../myoverview/components/myoverview/myoverview.ts | 12 +++++++++++- src/core/features/courses/pages/my/my.html | 3 --- src/core/features/courses/pages/my/my.ts | 11 ----------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html index 3718ea8e7..f0b31314a 100644 --- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -70,6 +70,11 @@ + + + {{'core.courses.searchcourses' | translate}} + diff --git a/src/addons/block/myoverview/components/myoverview/myoverview.ts b/src/addons/block/myoverview/components/myoverview/myoverview.ts index 8c97fa6c6..4bdfa9d7a 100644 --- a/src/addons/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addons/block/myoverview/components/myoverview/myoverview.ts @@ -30,6 +30,7 @@ import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursec import { AddonBlockMyOverviewFilterOptionsComponent } from '../filteroptions/filteroptions'; import { IonSearchbar } from '@ionic/angular'; import moment from 'moment'; +import { CoreNavigator } from '@services/navigator'; const FILTER_PRIORITY: AddonBlockMyOverviewTimeFilters[] = ['all', 'inprogress', 'future', 'past']; @@ -88,6 +89,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem textFilter = ''; hasCourses = false; + searchEnabled = false; protected currentSite!: CoreSite; protected allCourses: CoreEnrolledCourseDataWithOptions[] = []; @@ -110,12 +112,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem // Refresh the enabled flags if enabled. this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); + this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); // Refresh the enabled flags if site is updated. this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); - + this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); }, CoreSites.getCurrentSiteId()); this.coursesObserver = CoreEvents.on( @@ -676,6 +679,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem this.filterCourses(); } + /** + * Go to search courses. + */ + async openSearch(): Promise { + CoreNavigator.navigateToSitePath('/list', { params : { mode: 'search' } }); + } + /** * @inheritdoc */ diff --git a/src/core/features/courses/pages/my/my.html b/src/core/features/courses/pages/my/my.html index bf26674dc..1ea788466 100644 --- a/src/core/features/courses/pages/my/my.html +++ b/src/core/features/courses/pages/my/my.html @@ -11,9 +11,6 @@ - - - diff --git a/src/core/features/courses/pages/my/my.ts b/src/core/features/courses/pages/my/my.ts index 029225665..ad8f0a206 100644 --- a/src/core/features/courses/pages/my/my.ts +++ b/src/core/features/courses/pages/my/my.ts @@ -19,7 +19,6 @@ import { CoreCourseBlock } from '@features/course/services/course'; import { CoreCoursesDashboard, CoreCoursesDashboardProvider } from '@features/courses/services/dashboard'; import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager'; import { IonRefresher } from '@ionic/angular'; -import { CoreNavigator } from '@services/navigator'; import { CoreSites } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; @@ -38,7 +37,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { @ViewChild(CoreBlockComponent) block!: CoreBlockComponent; siteName = ''; - searchEnabled = false; downloadCoursesEnabled = false; userId: number; loadedBlock?: Partial; @@ -50,7 +48,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { constructor() { // Refresh the enabled flags if site is updated. this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { - this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); this.loadSiteName(); @@ -63,7 +60,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { * @inheritdoc */ ngOnInit(): void { - this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); const deepLinkManager = new CoreMainMenuDeepLinkManager(); @@ -122,13 +118,6 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { }; } - /** - * Go to search courses. - */ - async openSearch(): Promise { - CoreNavigator.navigateToSitePath('/list', { params : { mode: 'search' } }); - } - /** * Refresh the data. *