MOBILE-3814 my: Add site name to my courses page

main
Pau Ferrer Ocaña 2022-01-21 17:03:12 +01:00
parent 86d4dd5afc
commit 07df82153a
3 changed files with 21 additions and 4 deletions

View File

@ -4,7 +4,10 @@
<ion-back-button [text]="'core.back' | translate"></ion-back-button>
</ion-buttons>
<ion-title>
<h1>{{ 'core.courses.mycourses' | translate }}</h1>
<h1>
<core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0"></core-format-text>
<img src="assets/img/top_logo.png" class="core-header-logo" [alt]="siteName">
</h1>
</ion-title>
<ion-buttons slot="end">
<ion-button *ngIf="searchEnabled" (click)="openSearch()" [attr.aria-label]="'core.courses.searchcourses' | translate">
@ -30,6 +33,9 @@
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
</ion-refresher>
<core-loading [hideUntil]="loaded">
<div class="ion-padding-horizontal">
<h2>{{ 'core.courses.mycourses' | translate }}</h2>
</div>
<ion-list>
<core-block *ngIf="loadedBlock?.visible" [block]="loadedBlock" contextLevel="user" [instanceId]="userId"
[extraData]="{'downloadEnabled': true}"></core-block>

View File

@ -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.
*/

View File

@ -55,7 +55,7 @@ export class CoreMainMenuHomePage implements OnInit {
}
/**
* Initialize the component.
* @inheritdoc
*/
ngOnInit(): void {
this.route.queryParams.subscribe((params: Partial<CoreRedirectPayload> & { 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() || '';
}
/**