MOBILE-3120 resource: Display description if setting enabled

main
Albert Gasset 2019-09-06 16:34:45 +02:00
parent f441ce79f7
commit eb8f286d59
2 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,7 @@
<!-- Content. --> <!-- Content. -->
<core-loading [hideUntil]="loaded" class="core-loading-center"> <core-loading [hideUntil]="loaded" class="core-loading-center">
<core-course-module-description *ngIf="mode != 'iframe'" [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description> <core-course-module-description *ngIf="mode != 'iframe' && (mode != 'embedded' || displayDescription)" [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description>
<ng-container *ngIf="mode == 'iframe'"> <ng-container *ngIf="mode == 'iframe'">
<core-iframe [src]="src"></core-iframe> <core-iframe [src]="src"></core-iframe>

View File

@ -36,6 +36,7 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource
mode: string; mode: string;
src: string; src: string;
contentText: string; contentText: string;
displayDescription = true;
constructor(injector: Injector, private resourceProvider: AddonModResourceProvider, private courseProvider: CoreCourseProvider, constructor(injector: Injector, private resourceProvider: AddonModResourceProvider, private courseProvider: CoreCourseProvider,
private appProvider: CoreAppProvider, private prefetchHandler: AddonModResourcePrefetchHandler, private appProvider: CoreAppProvider, private prefetchHandler: AddonModResourcePrefetchHandler,
@ -96,6 +97,8 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource
}).then((resource) => { }).then((resource) => {
if (resource) { if (resource) {
this.description = resource.intro || resource.description; this.description = resource.intro || resource.description;
const options = this.textUtils.unserialize(resource.displayoptions) || {};
this.displayDescription = typeof options.printintro == 'undefined' || !!options.printintro;
this.dataRetrieved.emit(resource); this.dataRetrieved.emit(resource);
} }