Merge pull request #2062 from crazyserver/MOBILE-3068

Mobile 3068
main
Juan Leyva 2019-08-21 10:19:50 +01:00 committed by GitHub
commit ee4d1ad4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 13 deletions

View File

@ -31,17 +31,17 @@
<ion-icon name="information-circle"></ion-icon> {{ availabilityMessage }}
</ion-card>
<core-empty-box *ngIf="forum && discussions.length == 0 && offlineDiscussions.length == 0" icon="chatbubbles" [message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
</core-empty-box>
<div text-wrap *ngIf="sortingAvailable && selectedSortOrder" ion-row padding-horizontal padding-top margin-bottom>
<button *ngIf="sortingAvailable" ion-button padding-horizontal icon-end ion-col (click)="showSortOrderSelector($event)" color="light" class="core-button-select button-no-uppercase" [attr.aria-label]="('core.sort' | translate)" aria-haspopup="true" [attr.aria-expanded]="sortOrderSelectorExpanded" aria-controls="addon-mod-forum-sort-order-selector" id="addon-mod-forum-sort-order-button">
<span class="core-section-selector-text">{{ selectedSortOrder.label | translate }}</span>
<ion-icon name="arrow-dropdown" ios="md-arrow-dropdown"></ion-icon>
</button>
</div>
<ng-container *ngIf="forum">
<core-empty-box *ngIf="discussions.length == 0 && offlineDiscussions.length == 0" icon="chatbubbles" [message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
</core-empty-box>
<div text-wrap *ngIf="sortingAvailable && selectedSortOrder" ion-row padding-horizontal padding-top margin-bottom>
<button *ngIf="sortingAvailable" ion-button padding-horizontal icon-end ion-col (click)="showSortOrderSelector($event)" color="light" class="core-button-select button-no-uppercase" [attr.aria-label]="('core.sort' | translate)" aria-haspopup="true" [attr.aria-expanded]="sortOrderSelectorExpanded" aria-controls="addon-mod-forum-sort-order-selector" id="addon-mod-forum-sort-order-button">
<span class="core-section-selector-text">{{ selectedSortOrder.label | translate }}</span>
<ion-icon name="arrow-dropdown" ios="md-arrow-dropdown"></ion-icon>
</button>
</div>
<ion-card *ngFor="let discussion of offlineDiscussions" (click)="openNewDiscussion(discussion.timecreated)" [class.addon-forum-discussion-selected]="discussion.timecreated == -selectedDiscussion">
<ion-item text-wrap>
<ion-avatar core-user-avatar [user]="discussion" item-start [courseId]="courseId"></ion-avatar>
@ -95,9 +95,9 @@
</ion-col>
</ion-row>
</ion-card>
</ng-container>
<core-infinite-loading [enabled]="canLoadMore" (action)="fetchMoreDiscussions($event)" [error]="loadMoreError"></core-infinite-loading>
<core-infinite-loading [enabled]="canLoadMore" (action)="fetchMoreDiscussions($event)" [error]="loadMoreError"></core-infinite-loading>
</ng-container>
</core-loading>
<ion-fab core-fab bottom end *ngIf="forum && canAddDiscussion">

View File

@ -128,6 +128,8 @@ export class CoreTabComponent implements OnInit, OnDestroy {
});
this.tabs.showHideTabs(scroll);
}).catch(() => {
// Ignore errors.
});
}

View File

@ -417,6 +417,13 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
const scroll = parseInt(scrollElement.scrollTop, 10);
if (scroll == this.lastScroll) {
if (scroll == 0) {
// Ensure tabbar is shown.
this.topTabsElement.style.transform = '';
this.originalTabsContainer.style.transform = '';
this.originalTabsContainer.style.paddingBottom = this.tabBarHeight + 'px';
}
// Ensure scroll has been modified to avoid flicks.
return;
}
@ -438,7 +445,8 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
this.originalTabsContainer.style.transform = 'translateY(-' + scroll + 'px)';
this.originalTabsContainer.style.paddingBottom = this.tabBarHeight - scroll + 'px';
}
this.lastScroll = scroll;
// Use lastScroll after moving the tabs to avoid flickering.
this.lastScroll = parseInt(scrollElement.scrollTop, 10);
}
/**

View File

@ -67,6 +67,10 @@ export class CoreBlockCourseBlocksComponent implements OnInit, OnDestroy {
* Setup scrolling.
*/
protected initScroll(): void {
if (this.blocks.length <= 0) {
return;
}
const scroll: HTMLElement = this.content && this.content.getScrollElement();
this.domUtils.waitElementToExist(() => scroll && scroll.querySelector('.core-course-blocks-side')).then((sideElement) => {
@ -89,6 +93,8 @@ export class CoreBlockCourseBlocksComponent implements OnInit, OnDestroy {
this.sideScroll.classList.remove('core-course-blocks-fixed-bottom');
this.scrollWorking = false;
}
}).catch(() => {
// Ignore errors.
});
}