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. -->
<core-loading [hideUntil]="loaded" class="core-loading-center">
<core-tabs [selectedIndex]="selectedTab">
<core-tabs [hideUntil]="loaded" [selectedIndex]="selectedTab">
<!-- Index/Preview tab. -->
<core-tab [title]="'addon.mod_lesson.preview' | translate">
<ng-template>

View File

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

View File

@ -131,9 +131,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
ionViewDidEnter(): void {
this.isCurrentView = true;
if (this.initialized) {
this.calculateSlides();
}
this.registerBackButtonAction();
}
@ -188,6 +186,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
if (this.getIndex(tab) == -1) {
this.tabs.push(tab);
this.sortTabs();
this.calculateSlides();
if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) {
@ -204,7 +203,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
* Calculate slides.
*/
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.
return;
}
@ -288,10 +287,10 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
}
}
this.initialized = true;
// Check which arrows should be shown.
this.calculateSlides();
this.initialized = true;
}
/**