MOBILE-2915 lesson: Fix 'End of cluster' text displayed

main
Dani Palou 2019-03-28 11:59:24 +01:00
parent f969f99e01
commit 644f3c8a8b
2 changed files with 13 additions and 5 deletions

View File

@ -32,14 +32,14 @@
<!-- Page content. -->
<ion-card *ngIf="!eolData && !processData">
<!-- Content page. -->
<ion-item text-wrap *ngIf="!question">
<ion-item text-wrap *ngIf="!question && pageContent">
<core-format-text [component]="component" [componentId]="lesson.coursemodule" [text]="pageContent"></core-format-text>
</ion-item>
<!-- Question page. -->
<!-- We need to set ngIf loaded to make formGroup directive restart every time a page changes, see MOBILE-2540. -->
<form *ngIf="question && loaded" ion-list [formGroup]="questionForm">
<ion-item-divider text-wrap>
<ion-item-divider text-wrap *ngIf="pageContent">
<core-format-text [component]="component" [componentId]="lesson.coursemodule" [text]="pageContent"></core-format-text>
</ion-item-divider>

View File

@ -27,7 +27,8 @@ import { AddonModLessonProvider } from './lesson';
export class AddonModLessonHelperProvider {
constructor(private domUtils: CoreDomUtilsProvider, private fb: FormBuilder, private translate: TranslateService,
private textUtils: CoreTextUtilsProvider, private timeUtils: CoreTimeUtilsProvider) { }
private textUtils: CoreTextUtilsProvider, private timeUtils: CoreTimeUtilsProvider,
private lessonProvider: AddonModLessonProvider) { }
/**
* Given the HTML of next activity link, format it to extract the href and the text.
@ -149,8 +150,15 @@ export class AddonModLessonHelperProvider {
return contents.innerHTML.trim();
}
// Cannot find contents element, return the page.contents (some elements like videos might not work).
// Cannot find contents element.
if (this.lessonProvider.isQuestionPage(data.page.type) ||
data.page.qtype == AddonModLessonProvider.LESSON_PAGE_BRANCHTABLE) {
// Return page.contents to prevent having duplicated elements (some elements like videos might not work).
return data.page.contents;
} else {
// It's an end of cluster, end of branch, etc. Return the whole pagecontent to match what's displayed in web.
return data.pagecontent;
}
}
/**