Update transitions. Maybe add patch for clearing history on iOS.

This commit is contained in:
Georgi Prodanov 2017-03-09 17:14:18 +02:00
Родитель 699e9e9e76
Коммит abb3f7490d
4 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -76,7 +76,8 @@ export class EditEventComponent implements OnInit {
return this._alertsService.showSuccess(`Event "${this.event.Name}" updated!`);
})
.then((res) => {
this._routerExtensions.navigate([`/events/${this.event.Id}`]);
let transition = utilities.getReversePageTransition();
this._routerExtensions.navigate([`/events/${this.event.Id}`], { clearHistory: true, transition });
})
.catch(err => {
if (err) {

Просмотреть файл

@ -96,6 +96,10 @@ export class EventDetailsComponent implements OnInit {
this._routerExtensions.navigate([`/events/${this.event.Id}/edit`]);
}
canGoBack() {
return this._routerExtensions.canGoBack();
}
canEdit() {
return this._currentUser && this.event && !this.isPastEvent && this.event.Owner === this._currentUser.Id;
}
@ -158,8 +162,9 @@ export class EventDetailsComponent implements OnInit {
onBack() {
if (this._routerExtensions.canGoBack()) {
this._routerExtensions.back();
} else {
this._routerExtensions.navigate(['/events'], { clearHistory: true });
} else { // simulate going back
let transition = utilities.getReversePageTransition();
this._routerExtensions.navigate(['/events'], { clearHistory: true, transition });
}
}

Просмотреть файл

@ -2,6 +2,9 @@
<ScrollView class="cntnr">
<ActionBarExtension>
<NavigationButton *ngIf="isAndroid" icon="res://icon_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid && !canGoBack()" ios.systemIcon="1" ios.position="left" (tap)="onBack()">
<label text="Back"></label>
</ActionItem>
<ActionItem *ngIf="canEdit()" (tap)="onEdit()" ios.position="right">
<StackLayout>
<Label class="button if" text="&#x65;"></Label>

Просмотреть файл

@ -119,3 +119,7 @@ export function getMenuTransition() {
export function getPageTransition() {
return getTransition();
}
export function getReversePageTransition() {
return getTransition('slideRight');
}