MOBILE-4348 label: Support has custom cm list item to match cards border
parent
ecd7ced223
commit
6b0cd694c5
|
@ -56,6 +56,7 @@ export class AddonModLabelModuleHandlerService extends CoreModuleHandlerBase imp
|
||||||
title,
|
title,
|
||||||
a11yTitle: '',
|
a11yTitle: '',
|
||||||
class: 'addon-mod-label-handler',
|
class: 'addon-mod-label-handler',
|
||||||
|
hasCustomCmListItem: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ export class CoreModuleHandlerBase implements Partial<CoreCourseModuleHandler> {
|
||||||
title: module.name,
|
title: module.name,
|
||||||
class: 'addon-mod_' + module.modname + '-handler',
|
class: 'addon-mod_' + module.modname + '-handler',
|
||||||
showDownloadButton: true,
|
showDownloadButton: true,
|
||||||
|
hasCustomCmListItem: false,
|
||||||
action: async (
|
action: async (
|
||||||
event: Event,
|
event: Event,
|
||||||
module: CoreCourseModuleData,
|
module: CoreCourseModuleData,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<ion-card *ngIf="module.handlerData && module.visibleoncoursepage !== 0"
|
<ion-card *ngIf="module.handlerData && module.visibleoncoursepage !== 0"
|
||||||
class="activity-card core-course-module-handler {{module.handlerData.class}}" [class.core-course-module-with-view]="moduleHasView"
|
class="activity-card core-course-module-handler {{module.handlerData.class}}" [class.core-course-module-with-view]="moduleHasView"
|
||||||
[class.item-dimmed]="module.visible === 0 || module.uservisible === false" (click)="moduleClicked($event)"
|
[class.item-dimmed]="module.visible === 0 || module.uservisible === false" [class.activityinline]="activityInline"
|
||||||
[button]="module.handlerData.action && module.uservisible"
|
(click)="moduleClicked($event)" [button]="module.handlerData.action && module.uservisible"
|
||||||
[attr.aria-label]="module.handlerData.a11yTitle ? module.handlerData.a11yTitle : null" id="core-course-module-{{module.id}}">
|
[attr.aria-label]="module.handlerData.a11yTitle ? module.handlerData.a11yTitle : null" id="core-course-module-{{module.id}}">
|
||||||
<ng-container *ngIf="!module.handlerData.loading">
|
<ng-container *ngIf="!module.handlerData.loading">
|
||||||
<ion-item class="ion-text-wrap">
|
<ion-item class="ion-text-wrap">
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
ion-card {
|
ion-card {
|
||||||
margin: var(--vertical-margin) var(--horizontal-margin);
|
margin: var(--vertical-margin) var(--horizontal-margin);
|
||||||
|
|
||||||
|
&.activityinline {
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ion-item {
|
ion-item {
|
||||||
|
|
|
@ -65,6 +65,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
|
||||||
prefetchStatusIcon$ = new BehaviorSubject<string>(''); // Module prefetch status icon.
|
prefetchStatusIcon$ = new BehaviorSubject<string>(''); // Module prefetch status icon.
|
||||||
prefetchStatusText$ = new BehaviorSubject<string>(''); // Module prefetch status text.
|
prefetchStatusText$ = new BehaviorSubject<string>(''); // Module prefetch status text.
|
||||||
moduleHasView = true;
|
moduleHasView = true;
|
||||||
|
activityInline = false;
|
||||||
|
|
||||||
protected prefetchHandler?: CoreCourseModulePrefetchHandler;
|
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.module.handlerData.a11yTitle = this.module.handlerData.a11yTitle ?? this.module.handlerData.title;
|
||||||
this.moduleHasView = CoreCourse.moduleHasView(this.module);
|
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) {
|
if (this.showDownloadStatus && this.module.handlerData.showDownloadButton) {
|
||||||
const status = await CoreCourseModulePrefetchDelegate.getModuleStatus(this.module, this.module.course);
|
const status = await CoreCourseModulePrefetchDelegate.getModuleStatus(this.module, this.module.course);
|
||||||
this.updateModuleStatus(status);
|
this.updateModuleStatus(status);
|
||||||
|
|
|
@ -1784,6 +1784,7 @@ export type CoreCourseGetContentsWSModule = {
|
||||||
completion?: CoreCourseModuleCompletionTracking; // Type of completion tracking: 0 means none, 1 manual, 2 automatic.
|
completion?: CoreCourseModuleCompletionTracking; // Type of completion tracking: 0 means none, 1 manual, 2 automatic.
|
||||||
completiondata?: CoreCourseModuleWSCompletionData; // Module completion data.
|
completiondata?: CoreCourseModuleWSCompletionData; // Module completion data.
|
||||||
contents?: CoreCourseModuleContentFile[];
|
contents?: CoreCourseModuleContentFile[];
|
||||||
|
groupmode?: number; // @since 4.3. Group mode value
|
||||||
downloadcontent?: number; // @since 4.0 The download content value.
|
downloadcontent?: number; // @since 4.0 The download content value.
|
||||||
dates?: {
|
dates?: {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
|
@ -168,6 +168,14 @@ export interface CoreCourseModuleHandlerData {
|
||||||
*/
|
*/
|
||||||
showDownloadButton?: boolean;
|
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.
|
* The buttons to display in the module item.
|
||||||
*
|
*
|
||||||
|
|
|
@ -90,6 +90,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
|
||||||
icon: CoreCourse.getModuleIconSrc(module.modname, icon),
|
icon: CoreCourse.getModuleIconSrc(module.modname, icon),
|
||||||
class: this.handlerSchema.displaydata?.class,
|
class: this.handlerSchema.displaydata?.class,
|
||||||
showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline,
|
showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline,
|
||||||
|
hasCustomCmListItem: this.handlerSchema.hascustomcmlistitem ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.handlerSchema.method) {
|
if (this.handlerSchema.method) {
|
||||||
|
|
|
@ -895,6 +895,7 @@ export type CoreSitePluginsCourseModuleHandlerData = CoreSitePluginsHandlerCommo
|
||||||
supportedfeatures?: Record<string, unknown>;
|
supportedfeatures?: Record<string, unknown>;
|
||||||
manualcompletionalwaysshown?: boolean;
|
manualcompletionalwaysshown?: boolean;
|
||||||
nolinkhandlers?: boolean;
|
nolinkhandlers?: boolean;
|
||||||
|
hascustomcmlistitem?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue