commit
3b7e6426e0
|
@ -1,4 +1,4 @@
|
||||||
<ion-card *ngIf="module.handlerData && module.visibleoncoursepage !== 0">
|
<ion-card *ngIf="module.handlerData && module.visibleoncoursepage !== 0" [class.core-course-module-with-view]="moduleHasView">
|
||||||
<ng-container *ngIf="!module.handlerData.loading">
|
<ng-container *ngIf="!module.handlerData.loading">
|
||||||
<ion-item id="core-course-module-{{module.id}}" detail="false"
|
<ion-item id="core-course-module-{{module.id}}" detail="false"
|
||||||
class="ion-text-wrap core-course-module-handler core-module-main-item {{module.handlerData.class}}"
|
class="ion-text-wrap core-course-module-handler core-module-main-item {{module.handlerData.class}}"
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.core-course-module-not-viewed {
|
&.core-course-module-not-viewed ion-card.core-course-module-with-view {
|
||||||
--ion-card-border-color: var(--core-course-module-not-viewed-border-color);
|
--ion-card-border-color: var(--core-course-module-not-viewed-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
|
||||||
prefetchStatusIcon = ''; // Module prefetch status icon.
|
prefetchStatusIcon = ''; // Module prefetch status icon.
|
||||||
prefetchStatusText = ''; // Module prefetch status text.
|
prefetchStatusText = ''; // Module prefetch status text.
|
||||||
autoCompletionTodo = false;
|
autoCompletionTodo = false;
|
||||||
|
moduleHasView = true;
|
||||||
|
|
||||||
protected prefetchHandler?: CoreCourseModulePrefetchHandler;
|
protected prefetchHandler?: CoreCourseModulePrefetchHandler;
|
||||||
|
|
||||||
|
@ -77,6 +78,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);
|
||||||
|
|
||||||
const completionStatus = this.showCompletionConditions && this.module.completiondata?.isautomatic &&
|
const completionStatus = this.showCompletionConditions && this.module.completiondata?.isautomatic &&
|
||||||
this.module.completiondata.tracking == CoreCourseModuleCompletionTracking.COMPLETION_TRACKING_AUTOMATIC
|
this.module.completiondata.tracking == CoreCourseModuleCompletionTracking.COMPLETION_TRACKING_AUTOMATIC
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {
|
||||||
CoreCourseModuleSummaryResult,
|
CoreCourseModuleSummaryResult,
|
||||||
CoreCourseModuleSummaryComponent,
|
CoreCourseModuleSummaryComponent,
|
||||||
} from '@features/course/components/module-summary/module-summary';
|
} from '@features/course/components/module-summary/module-summary';
|
||||||
|
import { CoreCourse } from '@features/course/services/course';
|
||||||
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
|
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||||
import {
|
import {
|
||||||
CoreCourseModuleDelegate,
|
CoreCourseModuleDelegate,
|
||||||
|
@ -35,7 +36,7 @@ import {
|
||||||
import { IonRefresher } from '@ionic/angular';
|
import { IonRefresher } from '@ionic/angular';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
|
import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoadedData } from '../plugin-content/plugin-content';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that displays the index of a module site plugin.
|
* Component that displays the index of a module site plugin.
|
||||||
|
@ -161,9 +162,12 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
||||||
/**
|
/**
|
||||||
* Function called when the data of the site plugin content is loaded.
|
* Function called when the data of the site plugin content is loaded.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
contentLoaded(data: CoreSitePluginsPluginContentLoadedData): void {
|
||||||
contentLoaded(refresh: boolean): void {
|
if (data.success) {
|
||||||
return;
|
CoreCourse.storeModuleViewed(this.courseId, this.module.id, {
|
||||||
|
sectionId: this.module.section,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,7 +43,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
@Input() data?: Record<string, unknown>; // Data to pass to the component.
|
@Input() data?: Record<string, unknown>; // Data to pass to the component.
|
||||||
@Input() preSets?: CoreSiteWSPreSets; // The preSets for the WS call.
|
@Input() preSets?: CoreSiteWSPreSets; // The preSets for the WS call.
|
||||||
@Input() pageTitle?: string; // Current page title. It can be used by the "new-content" directives.
|
@Input() pageTitle?: string; // Current page title. It can be used by the "new-content" directives.
|
||||||
@Output() onContentLoaded = new EventEmitter<boolean>(); // Emits an event when the content is loaded.
|
@Output() onContentLoaded = new EventEmitter<CoreSitePluginsPluginContentLoadedData>(); // Emits event when content is loaded.
|
||||||
@Output() onLoadingContent = new EventEmitter<boolean>(); // Emits an event when starts to load the content.
|
@Output() onLoadingContent = new EventEmitter<boolean>(); // Emits an event when starts to load the content.
|
||||||
|
|
||||||
content?: string; // Content.
|
content?: string; // Content.
|
||||||
|
@ -114,11 +114,11 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
this.jsData.updateContent = this.updateContent.bind(this);
|
this.jsData.updateContent = this.updateContent.bind(this);
|
||||||
this.jsData.updateModuleCourseContent = this.updateModuleCourseContent.bind(this);
|
this.jsData.updateModuleCourseContent = this.updateModuleCourseContent.bind(this);
|
||||||
|
|
||||||
this.onContentLoaded.emit(refresh);
|
this.onContentLoaded.emit({ refresh: !!refresh, success: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Make it think it's loaded - otherwise it sticks on 'loading' and stops navigation working.
|
// Make it think it's loaded - otherwise it sticks on 'loading' and stops navigation working.
|
||||||
this.content = '<div></div>';
|
this.content = '<div></div>';
|
||||||
this.onContentLoaded.emit(refresh);
|
this.onContentLoaded.emit({ refresh: !!refresh, success: false });
|
||||||
|
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
|
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -237,3 +237,8 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CoreSitePluginsPluginContentLoadedData = {
|
||||||
|
refresh: boolean;
|
||||||
|
success: boolean;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue