mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
Resolve "Very unusual back button behavior"
This commit is contained in:
@@ -16,10 +16,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Changelog</ion-title>
|
<ion-title>Changelog</ion-title>
|
||||||
<!-- TODO: translation -->
|
<!-- TODO: translation -->
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Licenses</ion-title>
|
<ion-title>Licenses</ion-title>
|
||||||
<!-- TODO: translation -->
|
<!-- TODO: translation -->
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title *ngIf="content; else titleLoading">{{
|
<ion-title *ngIf="content; else titleLoading">{{
|
||||||
'title' | translateSimple: content
|
'title' | translateSimple: content
|
||||||
|
|||||||
@@ -15,10 +15,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'assessments.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'assessments.TITLE' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<!--TODO: read this from the config (menu item title)-->
|
<!--TODO: read this from the config (menu item title)-->
|
||||||
<ion-title>{{ 'catalog.title' | translate | titlecase }}</ion-title>
|
<ion-title>{{ 'catalog.title' | translate | titlecase }}</ion-title>
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
<ion-header *ngIf="defaultHeader">
|
<ion-header *ngIf="defaultHeader">
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start" *ngIf="!isModal">
|
<ion-buttons slot="start" *ngIf="!isModal">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
||||||
<ion-buttons [slot]="isModal ? 'start' : 'primary'">
|
<ion-buttons [slot]="isModal ? 'start' : 'primary'">
|
||||||
|
|||||||
@@ -2,10 +2,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios" *ngIf="showDrawer">
|
<ion-toolbar color="primary" mode="ios" *ngIf="showDrawer">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ title | translate }}</ion-title>
|
<ion-title>{{ title | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'feedback.page.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'feedback.page.TITLE' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
|
||||||
<ion-buttons slot="primary">
|
<ion-buttons slot="primary">
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'hebisSearch.title' | translate }}</ion-title>
|
<ion-title>{{ 'hebisSearch.title' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'library.account.title' | translate | titlecase }}</ion-title>
|
<ion-title>{{ 'library.account.title' | translate | titlecase }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{
|
<ion-title>{{
|
||||||
'library.account.pages.checked_out.title' | translate | titlecase
|
'library.account.pages.checked_out.title' | translate | titlecase
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{
|
<ion-title>{{
|
||||||
'library.account.pages.fines.title' | translate | titlecase
|
'library.account.pages.fines.title' | translate | titlecase
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{
|
<ion-title>{{
|
||||||
'library.account.pages.holds.title' | translate | titlecase
|
'library.account.pages.holds.title' | translate | titlecase
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{
|
<ion-title>{{
|
||||||
'library.account.pages.profile.title' | translate | titlecase
|
'library.account.pages.profile.title' | translate | titlecase
|
||||||
|
|||||||
@@ -18,17 +18,7 @@
|
|||||||
<ion-header class="ion-no-border" translucent="true">
|
<ion-header class="ion-no-border" translucent="true">
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
*ngIf="items.length !== 1"
|
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
<ion-back-button
|
|
||||||
*ngIf="items.length === 1"
|
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
(click)="resetView()"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'map.page.TITLE' | translate }}</ion-title>
|
<ion-title>{{ 'map.page.TITLE' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'news.title' | translate }}</ion-title>
|
<ion-title>{{ 'news.title' | translate }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'profile.title' | translate | titlecase }}</ion-title>
|
<ion-title>{{ 'profile.title' | translate | titlecase }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -16,10 +16,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title *ngIf="tabChoreographer.currentValue === 'calendar'">{{
|
<ion-title *ngIf="tabChoreographer.currentValue === 'calendar'">{{
|
||||||
'schedule.calendar' | translate | titlecase
|
'schedule.calendar' | translate | titlecase
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar color="primary" mode="ios">
|
<ion-toolbar color="primary" mode="ios">
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-back-button
|
<ion-back-button></ion-back-button>
|
||||||
[defaultHref]="'..'"
|
|
||||||
[text]="'back' | translate | titlecase"
|
|
||||||
></ion-back-button>
|
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>{{ 'settings.title' | translate | titlecase }}</ion-title>
|
<ion-title>{{ 'settings.title' | translate | titlecase }}</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
import {Directive, HostListener, Input, Optional} from '@angular/core';
|
|
||||||
import {
|
|
||||||
AnimationBuilder,
|
|
||||||
Config,
|
|
||||||
IonBackButtonDelegate,
|
|
||||||
IonRouterOutlet,
|
|
||||||
NavController,
|
|
||||||
} from '@ionic/angular';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides the default ion-back-button directive.
|
|
||||||
*
|
|
||||||
* @see https://github.com/ionic-team/ionic-framework/blob/main/angular/src/directives/navigation/ion-back-button.ts
|
|
||||||
*/
|
|
||||||
@Directive({
|
|
||||||
selector: 'ion-back-button',
|
|
||||||
})
|
|
||||||
export class IonBackButtonOverrideDirective {
|
|
||||||
@Input()
|
|
||||||
defaultHref: string | undefined | null;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
routerAnimation?: AnimationBuilder;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
@Optional() private routerOutlet: IonRouterOutlet,
|
|
||||||
private navCtrl: NavController,
|
|
||||||
private config: Config,
|
|
||||||
private ionBackButton: IonBackButtonDelegate,
|
|
||||||
) {
|
|
||||||
this.ionBackButton.onClick = () => {
|
|
||||||
// Override default onClick to prevent double execution and errors
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@HostListener('click', ['$event'])
|
|
||||||
onClick(event: Event): void {
|
|
||||||
const defaultHref =
|
|
||||||
this.defaultHref || this.config.get('backButtonDefaultHref');
|
|
||||||
|
|
||||||
// Handle back via angular navCtrl.back()
|
|
||||||
// (which is animated, instead of location.back)
|
|
||||||
if (defaultHref === '..') {
|
|
||||||
this.navCtrl.back();
|
|
||||||
} else if (this.routerOutlet?.canGoBack()) {
|
|
||||||
this.navCtrl.setDirection(
|
|
||||||
'back',
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
this.routerAnimation,
|
|
||||||
);
|
|
||||||
this.routerOutlet.pop();
|
|
||||||
event.preventDefault();
|
|
||||||
} else if (defaultHref != undefined) {
|
|
||||||
this.navCtrl.navigateBack(defaultHref, {animation: this.routerAnimation});
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,7 +21,6 @@ import {DateFromIndexPipe} from './date-from-index.pipe';
|
|||||||
import {DaytimeKeyPipe} from './daytime-key.pipe';
|
import {DaytimeKeyPipe} from './daytime-key.pipe';
|
||||||
import {LazyPipe} from './lazy.pipe';
|
import {LazyPipe} from './lazy.pipe';
|
||||||
import {NextDateInListPipe} from './next-date-in-list.pipe';
|
import {NextDateInListPipe} from './next-date-in-list.pipe';
|
||||||
import {IonBackButtonOverrideDirective} from './ion-back-button.directive';
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -32,7 +31,6 @@ import {IonBackButtonOverrideDirective} from './ion-back-button.directive';
|
|||||||
DateFromIndexPipe,
|
DateFromIndexPipe,
|
||||||
DaytimeKeyPipe,
|
DaytimeKeyPipe,
|
||||||
NextDateInListPipe,
|
NextDateInListPipe,
|
||||||
IonBackButtonOverrideDirective,
|
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
ArrayLastPipe,
|
ArrayLastPipe,
|
||||||
@@ -42,7 +40,6 @@ import {IonBackButtonOverrideDirective} from './ion-back-button.directive';
|
|||||||
DateFromIndexPipe,
|
DateFromIndexPipe,
|
||||||
DaytimeKeyPipe,
|
DaytimeKeyPipe,
|
||||||
NextDateInListPipe,
|
NextDateInListPipe,
|
||||||
IonBackButtonOverrideDirective,
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class UtilModule {}
|
export class UtilModule {}
|
||||||
|
|||||||
Reference in New Issue
Block a user