MOBILE-2795 lesson: Fix Reports tab not displayed sometimes

main
Dani Palou 2019-01-08 11:57:20 +01:00
parent a2f14a200e
commit a807e58920
3 changed files with 7 additions and 8 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-tabs [selectedIndex]="selectedTab"> <core-tabs [hideUntil]="loaded" [selectedIndex]="selectedTab">
<!-- Index/Preview tab. --> <!-- Index/Preview tab. -->
<core-tab [title]="'addon.mod_lesson.preview' | translate"> <core-tab [title]="'addon.mod_lesson.preview' | translate">
<ng-template> <ng-template>

View File

@ -105,7 +105,7 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase
module: module, module: module,
courseId: Number(courseId), courseId: Number(courseId),
action: 'report', action: 'report',
group: groupId group: isNaN(groupId) ? null : groupId
}; };
this.linkHelper.goInSite(navCtrl, 'AddonModLessonIndexPage', pageParams, siteId); this.linkHelper.goInSite(navCtrl, 'AddonModLessonIndexPage', pageParams, siteId);

View File

@ -131,9 +131,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
ionViewDidEnter(): void { ionViewDidEnter(): void {
this.isCurrentView = true; this.isCurrentView = true;
if (this.initialized) {
this.calculateSlides(); this.calculateSlides();
}
this.registerBackButtonAction(); this.registerBackButtonAction();
} }
@ -188,6 +186,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
if (this.getIndex(tab) == -1) { if (this.getIndex(tab) == -1) {
this.tabs.push(tab); this.tabs.push(tab);
this.sortTabs(); this.sortTabs();
this.calculateSlides(); this.calculateSlides();
if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) { if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) {
@ -204,7 +203,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
* Calculate slides. * Calculate slides.
*/ */
calculateSlides(): void { calculateSlides(): void {
if (!this.isCurrentView || !this.tabsShown) { if (!this.isCurrentView || !this.tabsShown || !this.initialized) {
// Don't calculate if component isn't in current view, the calculations are wrong. // Don't calculate if component isn't in current view, the calculations are wrong.
return; return;
} }
@ -288,10 +287,10 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
} }
} }
this.initialized = true;
// Check which arrows should be shown. // Check which arrows should be shown.
this.calculateSlides(); this.calculateSlides();
this.initialized = true;
} }
/** /**