MOBILE-2324 splitview: Fix splitview deactivation

main
Pau Ferrer Ocaña 2018-02-02 15:22:54 +01:00
parent 2ee117f935
commit c6032d76ed
8 changed files with 39 additions and 24 deletions

View File

@ -20,7 +20,7 @@
<core-empty-box *ngIf="!filteredEvents || !filteredEvents.length" icon="calendar" [message]="'addon.calendar.noevents' | translate">
</core-empty-box>
<ion-list *ngIf="filteredEvents && filteredEvents.length">
<ion-list *ngIf="filteredEvents && filteredEvents.length" no-margin>
<a ion-item text-wrap *ngFor="let event of filteredEvents" [title]="event.name" (click)="gotoEvent(event.id)" [class.core-split-item-selected]="event.id == eventId">
<img *ngIf="event.moduleIcon" src="{{event.moduleIcon}}" item-start class="core-module-icon">
<ion-icon *ngIf="!event.moduleIcon" name="{{event.icon}}" item-start></ion-icon>

View File

@ -85,7 +85,7 @@ export class CoreNavBarButtonsComponent implements OnInit {
selector += '[end]';
}
buttonsContainer = header.querySelector(selector);
buttonsContainer = <HTMLElement> header.querySelector(selector);
if (buttonsContainer) {
this.domUtils.moveChildren(this.element, buttonsContainer);
}

View File

@ -36,4 +36,16 @@ core-split-view {
}
}
}
}
.ios ion-header + core-split-view ion-menu.split-pane-side ion-content{
top: $navbar-ios-height;
}
.md ion-header + core-split-view ion-menu.split-pane-side ion-content{
top: $navbar-md-height;
}
.wp ion-header + core-split-view ion-menu.split-pane-side ion-content{
top: $navbar-wp-height;
}

View File

@ -47,6 +47,7 @@ export class CoreSplitViewComponent implements OnInit {
@Input() when?: string | boolean = 'md';
protected isEnabled = false;
protected masterPageName = '';
protected masterPageIndex = 0;
protected loadDetailPage: any = false;
protected element: HTMLElement; // Current element.
@ -63,6 +64,7 @@ export class CoreSplitViewComponent implements OnInit {
ngOnInit(): void {
// Get the master page name and set an empty page as a placeholder.
this.masterPageName = this.masterNav.getActive().component.name;
this.masterPageIndex = this.masterNav.indexOf(this.masterNav.getActive());
this.emptyDetails();
}
@ -141,17 +143,19 @@ export class CoreSplitViewComponent implements OnInit {
activateSplitView(): void {
const currentView = this.masterNav.getActive(),
currentPageName = currentView.component.name;
if (currentPageName != this.masterPageName) {
// CurrentView is a 'Detail' page remove it from the 'master' nav stack.
this.masterNav.pop();
if (this.masterNav.getPrevious().component.name == this.masterPageName) {
if (currentPageName != this.masterPageName) {
// CurrentView is a 'Detail' page remove it from the 'master' nav stack.
this.masterNav.pop();
// And add it to the 'detail' nav stack.
this.detailNav.setRoot(currentView.component, currentView.data);
} else if (this.loadDetailPage) {
// MasterPage is shown, load the last detail page if found.
this.detailNav.setRoot(this.loadDetailPage.component, this.loadDetailPage.data);
// And add it to the 'detail' nav stack.
this.detailNav.setRoot(currentView.component, currentView.data);
} else if (this.loadDetailPage) {
// MasterPage is shown, load the last detail page if found.
this.detailNav.setRoot(this.loadDetailPage.component, this.loadDetailPage.data);
}
this.loadDetailPage = false;
}
this.loadDetailPage = false;
}
/**
@ -162,7 +166,7 @@ export class CoreSplitViewComponent implements OnInit {
currentPageName = detailView.component.name;
if (currentPageName != 'CoreSplitViewPlaceholderPage') {
// Current detail view is a 'Detail' page so, not the placeholder page, push it on 'master' nav stack.
this.masterNav.push(detailView.component, detailView.data);
this.masterNav.insert(this.masterPageIndex + 1, detailView.component, detailView.data);
}
}
}

View File

@ -60,13 +60,8 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges {
protected tabsShown = true;
protected scroll: HTMLElement; // Parent scroll element (if core-tabs is inside a ion-content).
constructor(element: ElementRef, content: Content) {
constructor(element: ElementRef, protected content: Content) {
this.tabBarElement = element.nativeElement;
setTimeout(() => {
if (content) {
this.scroll = content.getScrollElement();
}
}, 1);
}
/**
@ -168,8 +163,11 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges {
// Setup tab scrolling.
this.tabBarHeight = this.topTabsElement.offsetHeight;
this.originalTabsContainer.style.paddingBottom = this.tabBarHeight + 'px';
if (this.scroll) {
this.scroll.classList.add('no-scroll');
if (this.content) {
this.scroll = this.content.getScrollElement();
if (this.scroll) {
this.scroll.classList.add('no-scroll');
}
}
this.initialized = true;

View File

@ -7,7 +7,7 @@
<core-empty-box *ngIf="participants && participants.length == 0" icon="person" [message]="'core.user.noparticipants' | translate">
</core-empty-box>
<ion-list *ngIf="participants && participants.length > 0">
<ion-list *ngIf="participants && participants.length > 0" no-margin>
<a ion-item text-wrap *ngFor="let participant of participants" [title]="participant.fullname" (click)="gotoParticipant(participant.id)" [class.core-split-item-selected]="participant.id == participantId">
<ion-avatar item-start>
<img src="{{participant.profileimageurl}}" [alt]="'core.pictureof' | translate:{$a: participant.fullname}" core-external-content>

View File

@ -49,7 +49,7 @@ export class CoreUserParticipantsComponent implements OnInit {
this.gotoParticipant(this.participants[0].id);
}
// Add log in Moodle.
this.userProvider.logView(this.courseId).catch(() => {
this.userProvider.logParticipantsView(this.courseId).catch(() => {
// Ignore errors.
});
}).finally(() => {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component } from '@angular/core';
import { Component, Optional } from '@angular/core';
import { IonicPage, NavParams, NavController } from 'ionic-angular';
import { CoreUserProvider } from '../../providers/user';
import { CoreUserHelperProvider } from '../../providers/helper';
@ -54,7 +54,8 @@ export class CoreUserProfilePage {
private domUtils: CoreDomUtilsProvider, private translate: TranslateService, private eventsProvider: CoreEventsProvider,
private coursesProvider: CoreCoursesProvider, private sitesProvider: CoreSitesProvider,
private mimetypeUtils: CoreMimetypeUtilsProvider, private fileUploaderHelper: CoreFileUploaderHelperProvider,
private userDelegate: CoreUserDelegate, private svComponent: CoreSplitViewComponent, private navCtrl: NavController) {
private userDelegate: CoreUserDelegate, private navCtrl: NavController,
@Optional() private svComponent: CoreSplitViewComponent) {
this.userId = navParams.get('userId');
this.courseId = navParams.get('courseId');