From 9514f1e719f76285c2ca559ba7a97932b35c0d1b Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 22 Mar 2022 09:56:32 +0100 Subject: [PATCH 1/2] MOBILE-3833 courses: Add site home link handler --- .../courses/services/handlers/dashboard-link.ts | 13 ++++++++++--- .../sitehome/services/handlers/index-link.ts | 17 +++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/core/features/courses/services/handlers/dashboard-link.ts b/src/core/features/courses/services/handlers/dashboard-link.ts index b506909cc..05ad995a0 100644 --- a/src/core/features/courses/services/handlers/dashboard-link.ts +++ b/src/core/features/courses/services/handlers/dashboard-link.ts @@ -15,17 +15,18 @@ import { Injectable } from '@angular/core'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; +import { CoreMainMenuHomeHandlerService } from '@features/mainmenu/services/handlers/mainmenu'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { CoreDashboardHomeHandler, CoreDashboardHomeHandlerService } from './dashboard-home'; /** - * Handler to treat links to my overview. + * Handler to treat links to dashboard. */ @Injectable({ providedIn: 'root' }) export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHandlerBase { - name = 'CoreCoursesMyOverviewLinkHandler'; + name = 'CoreCoursesDashboardLinkHandler'; pattern = /\/my\/?$/; /** @@ -37,7 +38,13 @@ export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHand return [{ action: (siteId): void => { // Use redirect to select the tab. - CoreNavigator.navigateToSitePath(CoreDashboardHomeHandlerService.PAGE_NAME, { siteId }); + CoreNavigator.navigateToSitePath( + `/${CoreMainMenuHomeHandlerService.PAGE_NAME}/${CoreDashboardHomeHandlerService.PAGE_NAME}`, + { + siteId, + preferCurrentTab: false, + }, + ); }, }]; } diff --git a/src/core/features/sitehome/services/handlers/index-link.ts b/src/core/features/sitehome/services/handlers/index-link.ts index fcb3b4b99..1f6e333a6 100644 --- a/src/core/features/sitehome/services/handlers/index-link.ts +++ b/src/core/features/sitehome/services/handlers/index-link.ts @@ -20,6 +20,8 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl import { CoreSiteHome } from '../sitehome'; import { makeSingleton } from '@singletons'; import { CoreNavigator } from '@services/navigator'; +import { CoreSiteHomeHomeHandlerService } from './sitehome-home'; +import { CoreMainMenuHomeHandlerService } from '@features/mainmenu/services/handlers/mainmenu'; /** * Handler to treat links to site home index. @@ -29,7 +31,7 @@ export class CoreSiteHomeIndexLinkHandlerService extends CoreContentLinksHandler name = 'CoreSiteHomeIndexLinkHandler'; featureName = 'CoreMainMenuDelegate_CoreSiteHome'; - pattern = /\/course\/view\.php.*([?&]id=\d+)/; + pattern = /\/course\/view\.php.*([?&]id=\d+)|\/index\.php(\?redirect=0)?/; /** * @inheritdoc @@ -37,10 +39,13 @@ export class CoreSiteHomeIndexLinkHandlerService extends CoreContentLinksHandler getActions(): CoreContentLinksAction[] | Promise { return [{ action: (siteId: string): void => { - CoreNavigator.navigateToSitePath('/home/site', { - preferCurrentTab: false, - siteId, - }); + CoreNavigator.navigateToSitePath( + `/${CoreMainMenuHomeHandlerService.PAGE_NAME}/${CoreSiteHomeHomeHandlerService.PAGE_NAME}`, + { + preferCurrentTab: false, + siteId, + }, + ); }, }]; } @@ -51,7 +56,7 @@ export class CoreSiteHomeIndexLinkHandlerService extends CoreContentLinksHandler async isEnabled(siteId: string, url: string, params: Record, courseId?: number): Promise { courseId = parseInt(params.id, 10); if (!courseId) { - return false; + return url.includes('index.php'); } const site = await CoreSites.getSite(siteId); From 8cd6869f354fff9ac31a12dbf22d091702da8295 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 22 Mar 2022 10:50:16 +0100 Subject: [PATCH 2/2] MOBILE-3833 core: Fix site listing styles --- src/core/features/login/pages/site/site.scss | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/features/login/pages/site/site.scss b/src/core/features/login/pages/site/site.scss index b7e1f5767..5f666b0cf 100644 --- a/src/core/features/login/pages/site/site.scss +++ b/src/core/features/login/pages/site/site.scss @@ -38,7 +38,8 @@ max-width: fit-content; width: auto; height: auto; - margin: 0 50% 0 auto; // LTR will be applied on transform. + margin: 0 auto; + margin-left: 50%; @include transform(translate3d(-50%,0,0)); object-fit: cover; object-position: 50% 50%; @@ -50,6 +51,15 @@ } } +:host-context([dir="rtl"]) { + + .item ion-thumbnail img { + margin-left: 0; + margin-right: 50%; + } + +} + .core-login-site-logo, .core-login-site-list, .core-login-site-list-found {