From 07df82153adc9cc9036334f9c7312c8c499daec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 21 Jan 2022 17:03:12 +0100 Subject: [PATCH] MOBILE-3814 my: Add site name to my courses page --- src/core/features/courses/pages/my/my.html | 8 +++++++- src/core/features/courses/pages/my/my.ts | 13 ++++++++++++- src/core/features/mainmenu/pages/home/home.ts | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/core/features/courses/pages/my/my.html b/src/core/features/courses/pages/my/my.html index bdd93c60b..5ac663842 100644 --- a/src/core/features/courses/pages/my/my.html +++ b/src/core/features/courses/pages/my/my.html @@ -4,7 +4,10 @@ -

{{ 'core.courses.mycourses' | translate }}

+

+ + +

@@ -30,6 +33,9 @@ +
+

{{ 'core.courses.mycourses' | translate }}

+
diff --git a/src/core/features/courses/pages/my/my.ts b/src/core/features/courses/pages/my/my.ts index 45365fd23..4e3b5e6f9 100644 --- a/src/core/features/courses/pages/my/my.ts +++ b/src/core/features/courses/pages/my/my.ts @@ -36,6 +36,7 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { @ViewChild(CoreBlockComponent) block!: CoreBlockComponent; + siteName = ''; searchEnabled = false; downloadCoursesEnabled = false; userId: number; @@ -50,6 +51,8 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); + this.loadSiteName(); + }, CoreSites.getCurrentSiteId()); this.userId = CoreSites.getCurrentSiteUserId(); @@ -62,8 +65,9 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); - this.loadContent(); + this.loadSiteName(); + this.loadContent(); } /** @@ -97,6 +101,13 @@ export class CoreCoursesMyCoursesPage implements OnInit, OnDestroy { this.loaded = true; } + /** + * Load the site name. + */ + protected loadSiteName(): void { + this.siteName = CoreSites.getRequiredCurrentSite().getSiteName() || ''; + } + /** * Load fallback blocks. */ diff --git a/src/core/features/mainmenu/pages/home/home.ts b/src/core/features/mainmenu/pages/home/home.ts index b5d9499a9..2db2c4811 100644 --- a/src/core/features/mainmenu/pages/home/home.ts +++ b/src/core/features/mainmenu/pages/home/home.ts @@ -55,7 +55,7 @@ export class CoreMainMenuHomePage implements OnInit { } /** - * Initialize the component. + * @inheritdoc */ ngOnInit(): void { this.route.queryParams.subscribe((params: Partial & { urlToOpen?: string }) => { @@ -121,7 +121,7 @@ export class CoreMainMenuHomePage implements OnInit { * Load the site name. */ protected loadSiteName(): void { - this.siteName = CoreSites.getCurrentSite()?.getSiteName() || ''; + this.siteName = CoreSites.getRequiredCurrentSite().getSiteName() || ''; } /**