diff --git a/scripts/langindex.json b/scripts/langindex.json index 694fff759..79ac9b310 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1515,7 +1515,6 @@ "core.course.confirmdownloadzerosize": "local_moodlemobileapp", "core.course.confirmlimiteddownload": "local_moodlemobileapp", "core.course.confirmpartialdownloadsize": "local_moodlemobileapp", - "core.course.contents": "local_moodlemobileapp", "core.course.couldnotloadsectioncontent": "local_moodlemobileapp", "core.course.couldnotloadsections": "local_moodlemobileapp", "core.course.coursesummary": "moodle", @@ -2274,7 +2273,6 @@ "core.updaterequireddesc": "local_moodlemobileapp", "core.upgraderunning": "error", "core.user": "moodle", - "core.user.account": "local_moodlemobileapp", "core.user.address": "moodle", "core.user.city": "moodle", "core.user.contact": "local_moodlemobileapp", @@ -2300,6 +2298,7 @@ "core.user.sendemail": "local_moodlemobileapp", "core.user.student": "moodle/defaultcoursestudent", "core.user.teacher": "moodle/noneditingteacher", + "core.user.useraccount": "moodle", "core.user.userwithid": "local_moodlemobileapp", "core.user.webpage": "moodle", "core.userdeleted": "moodle", diff --git a/src/core/features/course/lang.json b/src/core/features/course/lang.json index bba7ba758..f6f144b2d 100644 --- a/src/core/features/course/lang.json +++ b/src/core/features/course/lang.json @@ -26,7 +26,6 @@ "confirmdownloadzerosize": "You are about to start downloading.{{availableSpace}} Are you sure you want to continue?", "confirmpartialdownloadsize": "You are about to download at least {{size}}.{{availableSpace}} Are you sure you want to continue?", "confirmlimiteddownload": "You are not currently connected to Wi-Fi. ", - "contents": "Contents", "gotonextactivity": "Continue to next activity", "gotonextactivitynotfound": "Next activity not found. It's possible that it has been hidden or deleted.", "gotopreviousactivity": "Continue to previous activity", diff --git a/src/core/features/course/pages/contents/contents.ts b/src/core/features/course/pages/contents/contents.ts index 43bbcfb2d..a4de288f3 100644 --- a/src/core/features/course/pages/contents/contents.ts +++ b/src/core/features/course/pages/contents/contents.ts @@ -385,7 +385,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy { openCourseSummary(): void { CoreNavigator.navigateToSitePath( '/course/' + this.course.id + '/preview', - { params: { course: this.course, avoidOpenCourse: true } }, + { params: { course: this.course } }, ); } diff --git a/src/core/features/course/pages/index/index.page.ts b/src/core/features/course/pages/index/index.page.ts index 68ae06832..096de4843 100644 --- a/src/core/features/course/pages/index/index.page.ts +++ b/src/core/features/course/pages/index/index.page.ts @@ -51,7 +51,7 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy { protected isGuest?: boolean; protected contentsTab: CoreTabsOutletTab = { page: CONTENTS_PAGE_NAME, - title: 'core.course.contents', + title: 'core.course', pageParams: {}, }; diff --git a/src/core/features/course/pages/preview/preview.html b/src/core/features/course/pages/preview/preview.html index 92b3ff1eb..4969b265b 100644 --- a/src/core/features/course/pages/preview/preview.html +++ b/src/core/features/course/pages/preview/preview.html @@ -21,8 +21,8 @@
- +

@@ -121,11 +121,10 @@

{{ 'core.course.refreshcourse' | translate }}

- + -

{{ 'core.course.contents' | translate }}

+

{{ 'core.course' | translate }}

diff --git a/src/core/features/course/pages/preview/preview.page.ts b/src/core/features/course/pages/preview/preview.page.ts index 65fd8e105..923eb7109 100644 --- a/src/core/features/course/pages/preview/preview.page.ts +++ b/src/core/features/course/pages/preview/preview.page.ts @@ -51,7 +51,6 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { selfEnrolInstances: CoreCourseEnrolmentMethod[] = []; paypalEnabled = false; dataLoaded = false; - avoidOpenCourse = false; prefetchCourseData: CorePrefetchStatusInfo = { icon: '', statusTranslatable: 'core.loading', @@ -97,7 +96,6 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { */ async ngOnInit(): Promise { this.course = CoreNavigator.getRouteParam('course'); - this.avoidOpenCourse = !!CoreNavigator.getRouteBooleanParam('avoidOpenCourse'); if (!this.course) { CoreNavigator.back(); @@ -238,8 +236,7 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy { * Open the course. */ openCourse(): void { - if (!this.canAccessCourse || this.avoidOpenCourse) { - // Course cannot be opened or we are avoiding opening because we accessed from inside a course. + if (!this.canAccessCourse) { return; } 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/components/user-menu-button/user-menu-button.html b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html index 998f7e7c0..187ad5ef7 100644 --- a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html +++ b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html @@ -1,3 +1,3 @@ + (ariaButtonClick)="openUserMenu($event)" role="button" tabindex="0" [attr.aria-label]="'core.user.useraccount' | translate"> diff --git a/src/core/features/mainmenu/components/user-menu/user-menu.html b/src/core/features/mainmenu/components/user-menu/user-menu.html index 5b9b777b3..b24ab93c7 100644 --- a/src/core/features/mainmenu/components/user-menu/user-menu.html +++ b/src/core/features/mainmenu/components/user-menu/user-menu.html @@ -2,7 +2,7 @@

- {{'core.user.account' | translate}} + {{'core.user.useraccount' | translate}}

@@ -17,6 +17,9 @@ + +

diff --git a/src/core/features/mainmenu/components/user-menu/user-menu.scss b/src/core/features/mainmenu/components/user-menu/user-menu.scss index 924139eef..a42d797cd 100644 --- a/src/core/features/mainmenu/components/user-menu/user-menu.scss +++ b/src/core/features/mainmenu/components/user-menu/user-menu.scss @@ -8,6 +8,10 @@ } .core-usermenu-siteinfo { + text-align: center; + ion-label { + margin: 0; + } --padding-top: 10px; --padding-bottom: 10px; } @@ -19,9 +23,21 @@ } .core-usermenu-sitename { - font-size: 16px; + font-weight: bold; + font-size: 20px; + line-height: 24px; } +img.core-usermenu-site-logo { + margin-bottom: 8px; + max-height: var(--core-user-menu-site-logo-max-height); +} + +img.image-not-found { + display: none; +} + + @if ($core-user-hide-sitename) { .core-usermenu-sitename { display: none; diff --git a/src/core/features/mainmenu/components/user-menu/user-menu.ts b/src/core/features/mainmenu/components/user-menu/user-menu.ts index 1ec0e39ad..2ac460e3e 100644 --- a/src/core/features/mainmenu/components/user-menu/user-menu.ts +++ b/src/core/features/mainmenu/components/user-menu/user-menu.ts @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreConstants } from '@/core/constants'; import { Component, OnDestroy, OnInit } from '@angular/core'; -import { CoreSiteInfo } from '@classes/site'; +import { CoreSite, CoreSiteInfo } from '@classes/site'; import { CoreLoginSitesComponent } from '@features/login/components/sites/sites'; import { CoreLoginHelper } from '@features/login/services/login-helper'; import { CoreUser, CoreUserProfile } from '@features/user/services/user'; @@ -36,12 +37,13 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { siteInfo?: CoreSiteInfo; siteName?: string; + siteLogo?: string; + siteLogoLoaded = false; siteUrl?: string; handlers: CoreUserProfileHandlerData[] = []; handlersLoaded = false; loaded = false; user?: CoreUserProfile; - moreSites = false; protected subscription!: Subscription; @@ -49,10 +51,6 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { * @inheritdoc */ async ngOnInit(): Promise { - // Check if there are more sites to switch. - const sites = await CoreSites.getSites(); - this.moreSites = sites.length > 1; - const currentSite = CoreSites.getRequiredCurrentSite(); this.siteInfo = currentSite.getInfo(); this.siteName = currentSite.getSiteName(); @@ -60,6 +58,8 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { this.loaded = true; + this.loadSiteLogo(currentSite); + // Load the handlers. if (this.siteInfo) { this.user = await CoreUser.getProfile(this.siteInfo.userid); @@ -82,6 +82,31 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { } } + /** + * Load site logo from current site public config. + * + * @param currentSite Current site object. + * @return Promise resolved when done. + */ + protected async loadSiteLogo(currentSite: CoreSite): Promise { + if (CoreConstants.CONFIG.forceLoginLogo) { + this.siteLogo = 'assets/img/login_logo.png'; + this.siteLogoLoaded = true; + + return; + } + + try { + const siteConfig = await currentSite.getPublicConfig(); + + this.siteLogo = CoreLoginHelper.getLogoUrl(siteConfig); + } catch { + // Ignore errors. + } finally { + this.siteLogoLoaded = true; + } + } + /** * Opens User profile page. * 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() || ''; } /** diff --git a/src/core/features/settings/pages/about/about.html b/src/core/features/settings/pages/about/about.html index 061f88ec3..04d5a5971 100644 --- a/src/core/features/settings/pages/about/about.html +++ b/src/core/features/settings/pages/about/about.html @@ -13,12 +13,6 @@ - - - -

{{ appName }} {{ versionName }}

-
-
{{ 'core.settings.opensourcelicenses' | translate }} @@ -40,3 +34,12 @@
+ + + + +

{{ appName }} {{ versionName }}

+
+
+
diff --git a/src/core/features/settings/pages/about/about.scss b/src/core/features/settings/pages/about/about.scss new file mode 100644 index 000000000..d49c44f45 --- /dev/null +++ b/src/core/features/settings/pages/about/about.scss @@ -0,0 +1,3 @@ +.core-about-deviceinfo { + --background: transparent; +} diff --git a/src/core/features/settings/pages/about/about.ts b/src/core/features/settings/pages/about/about.ts index 9135a6316..256cf5fe6 100644 --- a/src/core/features/settings/pages/about/about.ts +++ b/src/core/features/settings/pages/about/about.ts @@ -24,6 +24,7 @@ import { CoreNavigator } from '@services/navigator'; @Component({ selector: 'page-core-app-settings-about', templateUrl: 'about.html', + styleUrls: ['about.scss'], }) export class CoreSettingsAboutPage { diff --git a/src/core/features/user/lang.json b/src/core/features/user/lang.json index 61d41e287..978102d21 100644 --- a/src/core/features/user/lang.json +++ b/src/core/features/user/lang.json @@ -1,6 +1,6 @@ { "address": "Address", - "account": "Account", + "useraccount": "User account", "city": "City/town", "contact": "Contact", "country": "Country", diff --git a/src/theme/theme.light.scss b/src/theme/theme.light.scss index 908669935..93f62f078 100644 --- a/src/theme/theme.light.scss +++ b/src/theme/theme.light.scss @@ -264,6 +264,8 @@ --core-course-module-navigation-max-height: 56px; --core-course-module-navigation-background: var(--contrast-background); + --core-user-menu-site-logo-max-height: 32px; + --addon-calendar-event-category-color: var(--purple); --addon-calendar-event-course-color: var(--red); --addon-calendar-event-group-color: var(--yellow);