Auto-redirect to default board
This commit is contained in:
parent
15ce789446
commit
fb00171bbe
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
You have not selected a default board. You may select a
|
You have not selected a default board. You may select a
|
||||||
default board in your Settings.
|
default board in your <a href="javascript:" [routerLink]="['/settings']">Settings</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>Until then, select a board from the list above.</p>
|
<p>Until then, select a board from the list above.</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ import { BoardService } from './board.service';
|
|||||||
selector: 'tb-board',
|
selector: 'tb-board',
|
||||||
templateUrl: 'app/board/board.component.html'
|
templateUrl: 'app/board/board.component.html'
|
||||||
})
|
})
|
||||||
export class BoardDisplay {
|
export class BoardDisplay implements OnInit {
|
||||||
private activeUser: User;
|
private activeUser: User;
|
||||||
private activeBoard: Board;
|
private activeBoard: Board;
|
||||||
private boards: Array<Board>;
|
private boards: Array<Board>;
|
||||||
@ -42,13 +42,6 @@ export class BoardDisplay {
|
|||||||
title.setTitle('TaskBoard - Kanban App');
|
title.setTitle('TaskBoard - Kanban App');
|
||||||
this.boardNavId = null;
|
this.boardNavId = null;
|
||||||
|
|
||||||
active.params.subscribe(params => {
|
|
||||||
let id = +params['id']; // tslint:disable-line
|
|
||||||
|
|
||||||
this.boardNavId = id ? id : null;
|
|
||||||
this.updateActiveBoard();
|
|
||||||
});
|
|
||||||
|
|
||||||
boardService.getBoards().subscribe((response: ApiResponse) => {
|
boardService.getBoards().subscribe((response: ApiResponse) => {
|
||||||
this.updateBoardsList(response.data[1]);
|
this.updateBoardsList(response.data[1]);
|
||||||
});
|
});
|
||||||
@ -56,6 +49,24 @@ export class BoardDisplay {
|
|||||||
auth.userChanged.subscribe((user: User) => {
|
auth.userChanged.subscribe((user: User) => {
|
||||||
this.updateActiveUser(user);
|
this.updateActiveUser(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
active.params.subscribe(params => {
|
||||||
|
let id = +params['id']; // tslint:disable-line
|
||||||
|
|
||||||
|
this.boardNavId = id ? id : null;
|
||||||
|
this.updateActiveBoard();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (this.boardNavId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.activeUser && this.activeUser.default_board_id) {
|
||||||
|
this.boardNavId = this.activeUser.default_board_id;
|
||||||
|
this.goToBoard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goToBoard(): void {
|
goToBoard(): void {
|
||||||
|
Reference in New Issue
Block a user