MOBILE-4362 activity: Show only description on list mod type page
parent
68f67ea4d5
commit
f986937424
|
@ -80,14 +80,14 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Description and restrictions -->
|
<!-- Description and restrictions -->
|
||||||
<div *ngIf="module.description || module.availabilityinfo" id="activity-{{module.id}}-collapsible"
|
<div *ngIf="module.description || (showAvailability && module.availabilityinfo)" id="activity-{{module.id}}-collapsible"
|
||||||
class="ion-text-wrap activity-description-availabilityinfo activity-extra" [collapsible-item]="64">
|
class="ion-text-wrap activity-description-availabilityinfo activity-extra" [collapsible-item]="64">
|
||||||
<core-format-text class="core-module-description" *ngIf="module.description" [text]="module.description"
|
<core-format-text class="core-module-description" *ngIf="module.description" [text]="module.description"
|
||||||
contextLevel="module" [contextInstanceId]="module.id" [courseId]="module.course">
|
contextLevel="module" [contextInstanceId]="module.id" [courseId]="module.course">
|
||||||
</core-format-text>
|
</core-format-text>
|
||||||
|
|
||||||
<!-- Availability info -->
|
<!-- Availability info -->
|
||||||
<div *ngIf="module.availabilityinfo" class="core-module-availabilityinfo">
|
<div *ngIf="showAvailability && module.availabilityinfo" class="core-module-availabilityinfo">
|
||||||
<ion-icon name="fas-lock" [attr.aria-label]="'core.restricted' | translate"></ion-icon>
|
<ion-icon name="fas-lock" [attr.aria-label]="'core.restricted' | translate"></ion-icon>
|
||||||
<core-format-text [text]="module.availabilityinfo" contextLevel="module" [contextInstanceId]="module.id"
|
<core-format-text [text]="module.availabilityinfo" contextLevel="module" [contextInstanceId]="module.id"
|
||||||
[courseId]="module.course">
|
[courseId]="module.course">
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="module.handlerData.extraBadge" class="ion-text-wrap activity-extrabadges activity-extra"
|
<div *ngIf="showExtra && module.handlerData.extraBadge" class="ion-text-wrap activity-extrabadges activity-extra"
|
||||||
[innerHTML]="module.handlerData.extraBadge"></div>
|
[innerHTML]="module.handlerData.extraBadge"></div>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,11 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
|
||||||
@Input() showActivityDates = false; // Whether to show activity dates.
|
@Input() showActivityDates = false; // Whether to show activity dates.
|
||||||
@Input() showCompletionConditions = false; // Whether to show activity completion conditions.
|
@Input() showCompletionConditions = false; // Whether to show activity completion conditions.
|
||||||
@Input() showLegacyCompletion?: boolean; // Whether to show module completion in the old format.
|
@Input() showLegacyCompletion?: boolean; // Whether to show module completion in the old format.
|
||||||
|
@Input() showCompletion = true; // Whether to show module completion.
|
||||||
|
@Input() showAvailability = true; // Whether to show module availability.
|
||||||
|
@Input() showExtra = true; // Whether to show extra badges.
|
||||||
|
@Input() showDownloadStatus = true; // Whether to show download status.
|
||||||
|
@Input() showIndentation = true; // Whether to show indentation
|
||||||
@Input() isLastViewed = false; // Whether it's the last module viewed in a course.
|
@Input() isLastViewed = false; // Whether it's the last module viewed in a course.
|
||||||
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when module completion changes.
|
@Output() completionChanged = new EventEmitter<CoreCourseModuleCompletionData>(); // Notify when module completion changes.
|
||||||
@HostBinding('class.indented') indented = false;
|
@HostBinding('class.indented') indented = false;
|
||||||
|
@ -70,14 +75,24 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
const site = CoreSites.getRequiredCurrentSite();
|
const site = CoreSites.getRequiredCurrentSite();
|
||||||
const enableIndentation = await CoreCourse.isCourseIndentationEnabled(site, this.module.course);
|
|
||||||
|
|
||||||
this.indented = enableIndentation && this.module.indent > 0;
|
if (this.showIndentation && this.module.indent > 0) {
|
||||||
|
this.indented = await CoreCourse.isCourseIndentationEnabled(site, this.module.course);
|
||||||
|
} else {
|
||||||
|
this.indented = false;
|
||||||
|
}
|
||||||
this.modNameTranslated = CoreCourse.translateModuleName(this.module.modname, this.module.modplural);
|
this.modNameTranslated = CoreCourse.translateModuleName(this.module.modname, this.module.modplural);
|
||||||
this.showLegacyCompletion = this.showLegacyCompletion ??
|
if (this.showCompletion) {
|
||||||
CoreConstants.CONFIG.uselegacycompletion ??
|
this.showLegacyCompletion = this.showLegacyCompletion ??
|
||||||
!site.isVersionGreaterEqualThan('3.11');
|
CoreConstants.CONFIG.uselegacycompletion ??
|
||||||
this.checkShowCompletion();
|
!site.isVersionGreaterEqualThan('3.11');
|
||||||
|
this.checkShowCompletion();
|
||||||
|
} else {
|
||||||
|
this.showLegacyCompletion = false;
|
||||||
|
this.showCompletionConditions = false;
|
||||||
|
this.showManualCompletion = false;
|
||||||
|
this.hasCompletion = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.module.handlerData) {
|
if (!this.module.handlerData) {
|
||||||
return;
|
return;
|
||||||
|
@ -86,7 +101,7 @@ 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?.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);
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,17 @@
|
||||||
|
|
||||||
<ion-list class="core-course-module-list-wrapper">
|
<ion-list class="core-course-module-list-wrapper">
|
||||||
<ng-container *ngFor="let section of sections">
|
<ng-container *ngFor="let section of sections">
|
||||||
|
<ion-item-divider class="course-section ion-text-wrap" *ngIf="section.name">
|
||||||
|
<ion-label>
|
||||||
|
<h2>
|
||||||
|
<core-format-text [text]="section.name" contextLevel="course" [contextInstanceId]="courseId">
|
||||||
|
</core-format-text>
|
||||||
|
</h2>
|
||||||
|
</ion-label>
|
||||||
|
</ion-item-divider>
|
||||||
<ng-container *ngFor="let module of section.modules">
|
<ng-container *ngFor="let module of section.modules">
|
||||||
<core-course-module *ngIf="module.visibleoncoursepage !== 0" [module]="module" [section]="section">
|
<core-course-module [module]="module" [section]="section" [showActivityDates]="false" [showAvailability]="false"
|
||||||
|
[showExtra]="false" [showDownloadStatus]="false" [showCompletion]="false" [showIndentation]="false">
|
||||||
</core-course-module>
|
</core-course-module>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -37,7 +37,7 @@ export class CoreCourseListModTypePage implements OnInit {
|
||||||
sections: CoreCourseSection[] = [];
|
sections: CoreCourseSection[] = [];
|
||||||
title = '';
|
title = '';
|
||||||
loaded = false;
|
loaded = false;
|
||||||
courseId?: number;
|
courseId = 0;
|
||||||
|
|
||||||
protected modName?: string;
|
protected modName?: string;
|
||||||
protected archetypes: Record<string, number> = {}; // To speed up the check of modules.
|
protected archetypes: Record<string, number> = {}; // To speed up the check of modules.
|
||||||
|
@ -64,9 +64,16 @@ export class CoreCourseListModTypePage implements OnInit {
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
this.title = CoreNavigator.getRouteParam('title') || '';
|
try {
|
||||||
this.courseId = CoreNavigator.getRouteNumberParam('courseId');
|
this.title = CoreNavigator.getRouteParam('title') || '';
|
||||||
this.modName = CoreNavigator.getRouteParam('modName');
|
this.courseId = CoreNavigator.getRequiredRouteParam('courseId');
|
||||||
|
this.modName = CoreNavigator.getRequiredRouteParam('modName');
|
||||||
|
} catch (error) {
|
||||||
|
CoreDomUtils.showErrorModal(error);
|
||||||
|
CoreNavigator.back();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.fetchData();
|
await this.fetchData();
|
||||||
|
@ -95,7 +102,9 @@ export class CoreCourseListModTypePage implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
section.modules = section.modules.filter((mod) => {
|
section.modules = section.modules.filter((mod) => {
|
||||||
if (!CoreCourseHelper.canUserViewModule(mod, section) || !CoreCourse.moduleHasView(mod)) {
|
if (!CoreCourseHelper.canUserViewModule(mod, section) ||
|
||||||
|
!CoreCourse.moduleHasView(mod) ||
|
||||||
|
mod.visibleoncoursepage === 0) {
|
||||||
// Ignore this module.
|
// Ignore this module.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -110,11 +119,11 @@ export class CoreCourseListModTypePage implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.archetypes[mod.modname] == CoreConstants.MOD_ARCHETYPE_RESOURCE) {
|
if (this.archetypes[mod.modname] === CoreConstants.MOD_ARCHETYPE_RESOURCE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (mod.modname == this.modName) {
|
} else if (mod.modname === this.modName) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -137,7 +146,7 @@ export class CoreCourseListModTypePage implements OnInit {
|
||||||
* @returns Promise resolved when done.
|
* @returns Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
async refreshData(refresher: IonRefresher): Promise<void> {
|
async refreshData(refresher: IonRefresher): Promise<void> {
|
||||||
await CoreUtils.ignoreErrors(CoreCourse.invalidateSections(this.courseId || 0));
|
await CoreUtils.ignoreErrors(CoreCourse.invalidateSections(this.courseId));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.fetchData();
|
await this.fetchData();
|
||||||
|
|
Loading…
Reference in New Issue