Merge pull request #1388 from dpalou/MOBILE-2440

MOBILE-2440 course: Display all sections
main
Juan Leyva 2018-07-04 10:47:03 +02:00 committed by GitHub
commit e52318e5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View File

@ -10,7 +10,7 @@
</ion-header>
<ion-content>
<ng-container *ngFor="let section of sections">
<a ion-item *ngIf="sectionHasContent(section)" text-wrap (click)="selectSection(section)" [class.core-primary-item]="selected.id == section.id" [class.item-dimmed]="section.visible === 0 || section.uservisible === false" detail-none>
<a ion-item *ngIf="section.hasContent" text-wrap (click)="selectSection(section)" [class.core-primary-item]="selected.id == section.id" [class.item-dimmed]="section.visible === 0 || section.uservisible === false" detail-none>
<h2><core-format-text [text]="section.formattedName || section.name"></core-format-text></h2>
<ion-badge color="secondary" *ngIf="section.visible === 0">{{ 'core.course.nocontentavailable' | translate }}</ion-badge>
<ion-badge color="secondary" *ngIf="section.availabilityinfo"><core-format-text [text]=" section.availabilityinfo"></core-format-text></ion-badge>

View File

@ -28,13 +28,10 @@ export class CoreCourseSectionSelectorPage {
sections: any;
selected: number;
sectionHasContent: any;
constructor(navParams: NavParams, courseHelper: CoreCourseHelperProvider, private viewCtrl: ViewController) {
this.sections = navParams.get('sections');
this.selected = navParams.get('selected');
this.sectionHasContent = courseHelper.sectionHasContent;
}
/**

View File

@ -194,7 +194,8 @@ export class CoreCourseSectionPage implements OnDestroy {
// Add a fake first section (all sections).
this.sections.unshift({
name: this.translate.instant('core.course.allsections'),
id: CoreCourseProvider.ALL_SECTIONS_ID
id: CoreCourseProvider.ALL_SECTIONS_ID,
hasContent: true
});
}

View File

@ -1168,7 +1168,7 @@ export class CoreCourseHelperProvider {
* @return {boolean} Whether the section has content.
*/
sectionHasContent(section: any): boolean {
if (section.id == CoreCourseProvider.ALL_SECTIONS_ID || section.hiddenbynumsections) {
if (section.hiddenbynumsections) {
return false;
}