diff --git a/src/addons/mod/label/services/handlers/module.ts b/src/addons/mod/label/services/handlers/module.ts index 9aea9b5a4..3507a8add 100644 --- a/src/addons/mod/label/services/handlers/module.ts +++ b/src/addons/mod/label/services/handlers/module.ts @@ -56,6 +56,7 @@ export class AddonModLabelModuleHandlerService extends CoreModuleHandlerBase imp title, a11yTitle: '', class: 'addon-mod-label-handler', + hasCustomCmListItem: true, }; } diff --git a/src/core/features/course/classes/module-base-handler.ts b/src/core/features/course/classes/module-base-handler.ts index 9f1235964..7bda916d1 100644 --- a/src/core/features/course/classes/module-base-handler.ts +++ b/src/core/features/course/classes/module-base-handler.ts @@ -45,6 +45,7 @@ export class CoreModuleHandlerBase implements Partial { title: module.name, class: 'addon-mod_' + module.modname + '-handler', showDownloadButton: true, + hasCustomCmListItem: false, action: async ( event: Event, module: CoreCourseModuleData, diff --git a/src/core/features/course/components/module/core-course-module.html b/src/core/features/course/components/module/core-course-module.html index ea67ff1c2..9d2dc797b 100644 --- a/src/core/features/course/components/module/core-course-module.html +++ b/src/core/features/course/components/module/core-course-module.html @@ -1,7 +1,7 @@ diff --git a/src/core/features/course/components/module/module.scss b/src/core/features/course/components/module/module.scss index f17b4f606..c19989d51 100644 --- a/src/core/features/course/components/module/module.scss +++ b/src/core/features/course/components/module/module.scss @@ -7,6 +7,10 @@ ion-card { margin: var(--vertical-margin) var(--horizontal-margin); + + &.activityinline { + border: 0px; + } } ion-item { diff --git a/src/core/features/course/components/module/module.ts b/src/core/features/course/components/module/module.ts index 439b3dab6..649f4f1b7 100644 --- a/src/core/features/course/components/module/module.ts +++ b/src/core/features/course/components/module/module.ts @@ -65,6 +65,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { prefetchStatusIcon$ = new BehaviorSubject(''); // Module prefetch status icon. prefetchStatusText$ = new BehaviorSubject(''); // Module prefetch status text. moduleHasView = true; + activityInline = false; protected prefetchHandler?: CoreCourseModulePrefetchHandler; @@ -101,6 +102,18 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { this.module.handlerData.a11yTitle = this.module.handlerData.a11yTitle ?? this.module.handlerData.title; this.moduleHasView = CoreCourse.moduleHasView(this.module); + if ( + this.module.handlerData.hasCustomCmListItem && + (!this.showAvailability || !this.module.availabilityinfo) && + (!this.showCompletion || !this.hasCompletion) && + (!this.showActivityDates || !this.module.dates?.length) && + !this.module.groupmode && + !(this.module.visible === 0) && + !(this.module.visible !== 0 && this.module.isStealth) + ) { + this.activityInline = true; + } + if (this.showDownloadStatus && this.module.handlerData.showDownloadButton) { const status = await CoreCourseModulePrefetchDelegate.getModuleStatus(this.module, this.module.course); this.updateModuleStatus(status); diff --git a/src/core/features/course/services/course.ts b/src/core/features/course/services/course.ts index c536c25d7..25586200a 100644 --- a/src/core/features/course/services/course.ts +++ b/src/core/features/course/services/course.ts @@ -1784,6 +1784,7 @@ export type CoreCourseGetContentsWSModule = { completion?: CoreCourseModuleCompletionTracking; // Type of completion tracking: 0 means none, 1 manual, 2 automatic. completiondata?: CoreCourseModuleWSCompletionData; // Module completion data. contents?: CoreCourseModuleContentFile[]; + groupmode?: number; // @since 4.3. Group mode value downloadcontent?: number; // @since 4.0 The download content value. dates?: { label: string; diff --git a/src/core/features/course/services/module-delegate.ts b/src/core/features/course/services/module-delegate.ts index faf5b59fc..920734e01 100644 --- a/src/core/features/course/services/module-delegate.ts +++ b/src/core/features/course/services/module-delegate.ts @@ -168,6 +168,14 @@ export interface CoreCourseModuleHandlerData { */ showDownloadButton?: boolean; + /** + * Wether activity has the custom cmlist item flag enabled. + * + * Activities like label uses this flag to indicate that it should be + * displayed as a custom course item instead of a tipical activity card. + */ + hasCustomCmListItem?: boolean; + /** * The buttons to display in the module item. * diff --git a/src/core/features/siteplugins/classes/handlers/module-handler.ts b/src/core/features/siteplugins/classes/handlers/module-handler.ts index 6f5de77c6..11854ac74 100644 --- a/src/core/features/siteplugins/classes/handlers/module-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/module-handler.ts @@ -90,6 +90,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp icon: CoreCourse.getModuleIconSrc(module.modname, icon), class: this.handlerSchema.displaydata?.class, showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline, + hasCustomCmListItem: this.handlerSchema.hascustomcmlistitem ?? false, }; if (this.handlerSchema.method) { diff --git a/src/core/features/siteplugins/services/siteplugins.ts b/src/core/features/siteplugins/services/siteplugins.ts index 76dc1569b..26257cbe1 100644 --- a/src/core/features/siteplugins/services/siteplugins.ts +++ b/src/core/features/siteplugins/services/siteplugins.ts @@ -895,6 +895,7 @@ export type CoreSitePluginsCourseModuleHandlerData = CoreSitePluginsHandlerCommo supportedfeatures?: Record; manualcompletionalwaysshown?: boolean; nolinkhandlers?: boolean; + hascustomcmlistitem?: boolean; }; /**