MOBILE-4389 course: Course format standalone component

main
Pau Ferrer Ocaña 2024-07-29 07:46:42 +02:00
parent 9e75f4c01f
commit e3b41c169e
5 changed files with 15 additions and 4 deletions

View File

@ -16,7 +16,6 @@ import { NgModule } from '@angular/core';
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { CoreBlockComponentsModule } from '@features/block/components/components.module'; import { CoreBlockComponentsModule } from '@features/block/components/components.module';
import { CoreCourseFormatComponent } from './course-format/course-format';
import { CoreCourseModuleComponent } from './module/module'; import { CoreCourseModuleComponent } from './module/module';
import { CoreCourseModuleCompletionComponent } from './module-completion/module-completion'; import { CoreCourseModuleCompletionComponent } from './module-completion/module-completion';
import { CoreCourseTagAreaComponent } from './tag-area/tag-area'; import { CoreCourseTagAreaComponent } from './tag-area/tag-area';
@ -30,7 +29,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-
@NgModule({ @NgModule({
declarations: [ declarations: [
CoreCourseFormatComponent,
CoreCourseModuleComponent, CoreCourseModuleComponent,
CoreCourseModuleCompletionComponent, CoreCourseModuleCompletionComponent,
CoreCourseModuleCompletionLegacyComponent, CoreCourseModuleCompletionLegacyComponent,
@ -47,7 +45,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-
CoreSharedModule, CoreSharedModule,
], ],
exports: [ exports: [
CoreCourseFormatComponent,
CoreCourseModuleComponent, CoreCourseModuleComponent,
CoreCourseModuleCompletionComponent, CoreCourseModuleCompletionComponent,
CoreCourseModuleCompletionLegacyComponent, CoreCourseModuleCompletionLegacyComponent,

View File

@ -53,6 +53,9 @@ import { CoreUserTourDirectiveOptions } from '@directives/user-tour';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ContextLevel } from '@/core/constants'; import { ContextLevel } from '@/core/constants';
import { CoreModals } from '@services/modals'; import { CoreModals } from '@services/modals';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreBlockComponentsModule } from '@features/block/components/components.module';
import { CoreCourseComponentsModule } from '../components.module';
/** /**
* Component to display course contents using a certain format. If the format isn't found, use default one. * Component to display course contents using a certain format. If the format isn't found, use default one.
@ -68,6 +71,12 @@ import { CoreModals } from '@services/modals';
selector: 'core-course-format', selector: 'core-course-format',
templateUrl: 'course-format.html', templateUrl: 'course-format.html',
styleUrls: ['course-format.scss'], styleUrls: ['course-format.scss'],
standalone: true,
imports: [
CoreSharedModule,
CoreBlockComponentsModule,
CoreCourseComponentsModule,
],
}) })
export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {

View File

@ -19,6 +19,7 @@ import { CoreCourseComponentsModule } from '@features/course/components/componen
import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedModule } from '@/core/shared.module';
import { resolveContentsRoutes } from '@features/course/course-contents-routing.module'; import { resolveContentsRoutes } from '@features/course/course-contents-routing.module';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreCourseFormatComponent } from './components/course-format/course-format';
/** /**
* Build module routes. * Build module routes.
@ -46,6 +47,7 @@ function buildRoutes(injector: Injector): Routes {
imports: [ imports: [
CoreSharedModule, CoreSharedModule,
CoreCourseComponentsModule, CoreCourseComponentsModule,
CoreCourseFormatComponent,
], ],
declarations: [ declarations: [
CoreCourseContentsPage, CoreCourseContentsPage,

View File

@ -99,10 +99,13 @@ export async function getCourseStandaloneComponents(): Promise<Type<unknown>[]>
// eslint-disable-next-line deprecation/deprecation // eslint-disable-next-line deprecation/deprecation
const { CoreCourseModuleManualCompletionComponent } = const { CoreCourseModuleManualCompletionComponent } =
await import('@features/course/components/module-manual-completion/module-manual-completion'); await import('@features/course/components/module-manual-completion/module-manual-completion');
const { CoreCourseFormatComponent } =
await import('@features/course/components/course-format/course-format');
return [ return [
CoreCourseModuleDescriptionComponent, CoreCourseModuleDescriptionComponent,
CoreCourseModuleManualCompletionComponent, CoreCourseModuleManualCompletionComponent,
CoreCourseFormatComponent,
]; ];
} }

View File

@ -1400,7 +1400,7 @@ export class CoreCourseProvider {
}); });
return; return;
} catch (error) { } catch {
// The site plugin failed to load. The user needs to restart the app to try loading it again. // The site plugin failed to load. The user needs to restart the app to try loading it again.
const message = Translate.instant('core.courses.errorloadplugins'); const message = Translate.instant('core.courses.errorloadplugins');
const reload = Translate.instant('core.courses.reload'); const reload = Translate.instant('core.courses.reload');