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()"> <form (ngSubmit)="submit()">
<header> <header>
<div class="left"> <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 class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span> <span>{{'back' | i18n}}</span>
</button> </a>
</div> </div>
<div class="center"> <div class="center">
<span class="title">{{'exportVault' | i18n}}</span> <span class="title">{{'exportVault' | i18n}}</span>

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
<header> <header>
<div class="left"> <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 class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span> <span>{{'back' | i18n}}</span>
</button> </a>
</div> </div>
<div class="center"> <div class="center">
<span class="title">{{'folders' | i18n}}</span> <span class="title">{{'folders' | i18n}}</span>

View File

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

View File

@ -1,9 +1,9 @@
<header> <header>
<div class="left"> <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 class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span> <span>{{'back' | i18n}}</span>
</button> </a>
</div> </div>
<div class="center"> <div class="center">
<span class="title">{{'sync' | i18n}}</span> <span class="title">{{'sync' | i18n}}</span>

View File

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