From d26e39861b8e582330e7e87e7e97e558e7b50193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Mon, 14 Feb 2022 10:50:46 +0100 Subject: [PATCH] MOBILE-3970 course: Change course preview page name to course summary --- src/core/features/course/course-lazy.module.ts | 4 ++-- .../course-summary.html} | 0 .../course-summary.module.ts} | 8 ++++---- .../course-summary.scss} | 0 .../course-summary.ts} | 10 +++++----- src/core/features/course/pages/index/index.module.ts | 2 +- src/core/features/course/pages/index/index.ts | 4 ++-- .../components/course-list-item/course-list-item.ts | 2 +- .../courses/services/handlers/enrol-push-click.ts | 2 +- .../courses/services/handlers/request-push-click.ts | 2 +- upgrade.txt | 1 + 11 files changed, 18 insertions(+), 17 deletions(-) rename src/core/features/course/pages/{preview/preview.html => course-summary/course-summary.html} (100%) rename src/core/features/course/pages/{preview/preview.module.ts => course-summary/course-summary.module.ts} (86%) rename src/core/features/course/pages/{preview/preview.scss => course-summary/course-summary.scss} (100%) rename src/core/features/course/pages/{preview/preview.page.ts => course-summary/course-summary.ts} (98%) diff --git a/src/core/features/course/course-lazy.module.ts b/src/core/features/course/course-lazy.module.ts index 5233864dd..691b8c05b 100644 --- a/src/core/features/course/course-lazy.module.ts +++ b/src/core/features/course/course-lazy.module.ts @@ -32,9 +32,9 @@ const routes: Routes = [ loadChildren: () => import('./pages/list-mod-type/list-mod-type.module').then(m => m.CoreCourseListModTypePageModule), }, { - path: ':courseId/preview', + path: ':courseId/summary', loadChildren: () => - import('./pages/preview/preview.module').then(m => m.CoreCoursePreviewPageModule), + import('./pages/course-summary/course-summary.module').then(m => m.CoreCourseSummaryPageModule), }, ]; diff --git a/src/core/features/course/pages/preview/preview.html b/src/core/features/course/pages/course-summary/course-summary.html similarity index 100% rename from src/core/features/course/pages/preview/preview.html rename to src/core/features/course/pages/course-summary/course-summary.html diff --git a/src/core/features/course/pages/preview/preview.module.ts b/src/core/features/course/pages/course-summary/course-summary.module.ts similarity index 86% rename from src/core/features/course/pages/preview/preview.module.ts rename to src/core/features/course/pages/course-summary/course-summary.module.ts index 3ef168504..daeb7f70c 100644 --- a/src/core/features/course/pages/preview/preview.module.ts +++ b/src/core/features/course/pages/course-summary/course-summary.module.ts @@ -16,12 +16,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCoursePreviewPage } from './preview.page'; +import { CoreCourseSummaryPage } from './course-summary'; const routes: Routes = [ { path: '', - component: CoreCoursePreviewPage, + component: CoreCourseSummaryPage, }, ]; @NgModule({ @@ -29,7 +29,7 @@ const routes: Routes = [ CoreSharedModule, ], declarations: [ - CoreCoursePreviewPage, + CoreCourseSummaryPage, ], }) export class CoreCoursePreviewPageComponentModule { } @@ -42,4 +42,4 @@ export class CoreCoursePreviewPageComponentModule { } ], exports: [RouterModule], }) -export class CoreCoursePreviewPageModule { } +export class CoreCourseSummaryPageModule { } diff --git a/src/core/features/course/pages/preview/preview.scss b/src/core/features/course/pages/course-summary/course-summary.scss similarity index 100% rename from src/core/features/course/pages/preview/preview.scss rename to src/core/features/course/pages/course-summary/course-summary.scss diff --git a/src/core/features/course/pages/preview/preview.page.ts b/src/core/features/course/pages/course-summary/course-summary.ts similarity index 98% rename from src/core/features/course/pages/preview/preview.page.ts rename to src/core/features/course/pages/course-summary/course-summary.ts index e53981367..547e9a6cb 100644 --- a/src/core/features/course/pages/preview/preview.page.ts +++ b/src/core/features/course/pages/course-summary/course-summary.ts @@ -39,14 +39,14 @@ import { CoreCourseWithImageAndColor } from '@features/courses/services/courses- import { Subscription } from 'rxjs'; /** - * Page that allows "previewing" a course and enrolling in it if enabled and not enrolled. + * Page that shows the summary of a course including buttons to enrol and other available options. */ @Component({ - selector: 'page-core-course-preview', - templateUrl: 'preview.html', - styleUrls: ['preview.scss'], + selector: 'page-core-course-summary', + templateUrl: 'course-summary.html', + styleUrls: ['course-summary.scss'], }) -export class CoreCoursePreviewPage implements OnInit, OnDestroy { +export class CoreCourseSummaryPage implements OnInit, OnDestroy { @Input() course?: CoreCourseSummaryData; @Input() courseId = 0; diff --git a/src/core/features/course/pages/index/index.module.ts b/src/core/features/course/pages/index/index.module.ts index b3dcd1791..fafa96425 100644 --- a/src/core/features/course/pages/index/index.module.ts +++ b/src/core/features/course/pages/index/index.module.ts @@ -19,7 +19,7 @@ import { resolveModuleRoutes } from '@/app/app-routing.module'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseIndexPage } from '.'; import { COURSE_INDEX_ROUTES } from './index-routing.module'; -import { CoreCoursePreviewPageComponentModule } from '../preview/preview.module'; +import { CoreCoursePreviewPageComponentModule } from '../course-summary/course-summary.module'; function buildRoutes(injector: Injector): Routes { const routes = resolveModuleRoutes(injector, COURSE_INDEX_ROUTES); diff --git a/src/core/features/course/pages/index/index.ts b/src/core/features/course/pages/index/index.ts index cf49aea06..449058e33 100644 --- a/src/core/features/course/pages/index/index.ts +++ b/src/core/features/course/pages/index/index.ts @@ -28,7 +28,7 @@ import { CoreNavigator } from '@services/navigator'; import { CONTENTS_PAGE_NAME } from '@features/course/course.module'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreCollapsibleHeaderDirective } from '@directives/collapsible-header'; -import { CoreCoursePreviewPage } from '../preview/preview.page'; +import { CoreCourseSummaryPage } from '../course-summary/course-summary'; /** * Page that displays the list of courses the user is enrolled in. @@ -281,7 +281,7 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy { } CoreDomUtils.openSideModal({ - component: CoreCoursePreviewPage, + component: CoreCourseSummaryPage, componentProps: { courseId: this.course.id, course: this.course, diff --git a/src/core/features/courses/components/course-list-item/course-list-item.ts b/src/core/features/courses/components/course-list-item/course-list-item.ts index c44645ed9..c73a3dd3a 100644 --- a/src/core/features/courses/components/course-list-item/course-list-item.ts +++ b/src/core/features/courses/components/course-list-item/course-list-item.ts @@ -171,7 +171,7 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On CoreCourseHelper.openCourse(this.course); } else { CoreNavigator.navigateToSitePath( - `/course/${this.course.id}/preview`, + `/course/${this.course.id}/summary`, { params: { course: this.course } }, ); } diff --git a/src/core/features/courses/services/handlers/enrol-push-click.ts b/src/core/features/courses/services/handlers/enrol-push-click.ts index c606d3384..63408f432 100644 --- a/src/core/features/courses/services/handlers/enrol-push-click.ts +++ b/src/core/features/courses/services/handlers/enrol-push-click.ts @@ -66,7 +66,7 @@ export class CoreCoursesEnrolPushClickHandlerService implements CorePushNotifica params.selectedTab = 'participants'; // @todo: Set this when participants is done. } else if (!result.enrolled) { // User not enrolled anymore, open the preview page. - page += '/preview'; + page += '/summary'; } await CoreNavigator.navigateToSitePath(page, { params, siteId: notification.site }); diff --git a/src/core/features/courses/services/handlers/request-push-click.ts b/src/core/features/courses/services/handlers/request-push-click.ts index 92fdea4fc..2eb12d9a9 100644 --- a/src/core/features/courses/services/handlers/request-push-click.ts +++ b/src/core/features/courses/services/handlers/request-push-click.ts @@ -79,7 +79,7 @@ export class CoreCoursesRequestPushClickHandlerService implements CorePushNotifi if (!result.enrolled) { // User not enrolled (shouldn't happen), open the preview page. - page += '/preview'; + page += '/summary'; } await CoreNavigator.navigateToSitePath(page, { params, siteId: notification.site }); diff --git a/upgrade.txt b/upgrade.txt index a7549b1c3..e943d0f93 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -18,6 +18,7 @@ information provided here is intended especially for developers. - CoreCourseHelperProvider.openCourse parameters changed, now it admits CoreNavigationOptions + siteId on the same object that includes Params passed to page. - displaySectionSelector has been deprecated on CoreCourseFormatHandler, use displayCourseIndex instead. - Most of the functions or callbacks that handle redirects/deeplinks have been modified to accept an object instead of just path + options. E.g.: CoreLoginHelper.isSiteLoggedOut, CoreLoginHelper.openBrowserForSSOLogin, CoreLoginHelper.openBrowserForOAuthLogin, CoreLoginHelper.prepareForSSOLogin, CoreApp.storeRedirect, CoreSites.loadSite. +- Course preview page route has changed from course/:courseId/preview to course/:courseId/summary to match with the page name and characteristics. === 3.9.5 ===