use router links instead of back

This commit is contained in:
Kyle Spearrin 2018-04-13 13:18:43 -04:00
parent 0505043e18
commit 40790790b2
8 changed files with 15 additions and 34 deletions

View File

@ -1,10 +1,10 @@
<form (ngSubmit)="submit()">
<header>
<div class="left">
<button type="button" appBlurClick (click)="close()">
<a routerLink="/tabs/settings">
<span class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span>
</button>
</a>
</div>
<div class="center">
<span class="title">{{'exportVault' | i18n}}</span>

View File

@ -1,8 +1,8 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -22,17 +22,13 @@ export class ExportComponent extends BaseExportComponent {
cipherService: CipherService, folderService: FolderService,
cryptoService: CryptoService, userService: UserService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
private location: Location) {
private router: Router) {
super(analytics, toasterService, cipherService, folderService, cryptoService, userService, i18nService,
platformUtilsService, window);
}
close() {
this.location.back();
}
protected saved() {
super.saved();
this.close();
this.router.navigate(['/tabs/settings']);
}
}

View File

@ -1,7 +1,7 @@
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<header>
<div class="left">
<button type="button" appBlurClick (click)="cancel()">{{'cancel' | i18n}}</button>
<a routerLink="/folders">{{'cancel' | i18n}}</a>
</div>
<div class="center">
<span class="title">{{title}}</span>

View File

@ -1,4 +1,3 @@
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import {
ActivatedRoute,
@ -23,8 +22,8 @@ import {
export class FolderAddEditComponent extends BaseFolderAddEditComponent {
constructor(folderService: FolderService, i18nService: I18nService,
analytics: Angulartics2, toasterService: ToasterService,
platformUtilsService: PlatformUtilsService, private location: Location,
private router: Router, private route: ActivatedRoute) {
platformUtilsService: PlatformUtilsService, private router: Router,
private route: ActivatedRoute) {
super(folderService, i18nService, analytics, toasterService, platformUtilsService);
}
@ -39,21 +38,17 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent {
async submit(): Promise<boolean> {
if (await super.submit()) {
this.location.back();
this.router.navigate(['/folders']);
return true;
}
return false;
}
cancel() {
this.location.back();
}
async delete(): Promise<boolean> {
const confirmed = await super.delete();
if (confirmed) {
this.location.back();
this.router.navigate(['/folders']);
}
return confirmed;
}

View File

@ -1,9 +1,9 @@
<header>
<div class="left">
<button appBlurClick type="button" (click)="close()">
<a routerLink="/tabs/settings">
<span class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span>
</button>
</a>
</div>
<div class="center">
<span class="title">{{'folders' | i18n}}</span>

View File

@ -1,4 +1,3 @@
import { Location } from '@angular/common';
import {
Component,
OnInit,
@ -16,8 +15,7 @@ import { FolderService } from 'jslib/abstractions/folder.service';
export class FoldersComponent implements OnInit {
folders: FolderView[];
constructor(private folderService: FolderService, private location: Location,
private router: Router) {
constructor(private folderService: FolderService, private router: Router) {
}
async ngOnInit() {
@ -31,8 +29,4 @@ export class FoldersComponent implements OnInit {
addFolder() {
this.router.navigate(['/add-folder']);
}
close() {
this.location.back();
}
}

View File

@ -1,9 +1,9 @@
<header>
<div class="left">
<button appBlurClick type="button" (click)="close()">
<a routerLink="/tabs/settings">
<span class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span>
</button>
</a>
</div>
<div class="center">
<span class="title">{{'sync' | i18n}}</span>

View File

@ -47,8 +47,4 @@ export class SyncComponent implements OnInit {
this.lastSync = this.i18nService.t('never');
}
}
close() {
this.router.navigate(['/tabs/settings']);
}
}