MOBILE-4348 label: Support has custom cm list item to match cards border
This commit is contained in:
		
							parent
							
								
									ecd7ced223
								
							
						
					
					
						commit
						6b0cd694c5
					
				| @ -56,6 +56,7 @@ export class AddonModLabelModuleHandlerService extends CoreModuleHandlerBase imp | ||||
|             title, | ||||
|             a11yTitle: '', | ||||
|             class: 'addon-mod-label-handler', | ||||
|             hasCustomCmListItem: true, | ||||
|         }; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -45,6 +45,7 @@ export class CoreModuleHandlerBase implements Partial<CoreCourseModuleHandler> { | ||||
|             title: module.name, | ||||
|             class: 'addon-mod_' + module.modname + '-handler', | ||||
|             showDownloadButton: true, | ||||
|             hasCustomCmListItem: false, | ||||
|             action: async ( | ||||
|                 event: Event, | ||||
|                 module: CoreCourseModuleData, | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| <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.item-dimmed]="module.visible === 0 || module.uservisible === false" (click)="moduleClicked($event)" | ||||
|     [button]="module.handlerData.action && module.uservisible" | ||||
|     [class.item-dimmed]="module.visible === 0 || module.uservisible === false" [class.activityinline]="activityInline" | ||||
|     (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}}"> | ||||
|     <ng-container *ngIf="!module.handlerData.loading"> | ||||
|         <ion-item class="ion-text-wrap"> | ||||
|  | ||||
| @ -7,6 +7,10 @@ | ||||
| 
 | ||||
|     ion-card { | ||||
|         margin: var(--vertical-margin) var(--horizontal-margin); | ||||
| 
 | ||||
|         &.activityinline { | ||||
|             border: 0px; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     ion-item { | ||||
|  | ||||
| @ -65,6 +65,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { | ||||
|     prefetchStatusIcon$ = new BehaviorSubject<string>(''); // Module prefetch status icon.
 | ||||
|     prefetchStatusText$ = new BehaviorSubject<string>(''); // 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); | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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. | ||||
|      * | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -895,6 +895,7 @@ export type CoreSitePluginsCourseModuleHandlerData = CoreSitePluginsHandlerCommo | ||||
|     supportedfeatures?: Record<string, unknown>; | ||||
|     manualcompletionalwaysshown?: boolean; | ||||
|     nolinkhandlers?: boolean; | ||||
|     hascustomcmlistitem?: boolean; | ||||
| }; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user