This repository was archived by the owner on Apr 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- router-deprecated + final router 🚀
- Loading branch information
1 parent
1752b3f
commit 9aaa672
Showing
36 changed files
with
301 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {Resolve, ActivatedRouteSnapshot} from '@angular/router'; | ||
import {Game} from '../../models/game'; | ||
import {GamesService} from '../../services/gamesService'; | ||
|
||
@Injectable() | ||
export class GameDetailsResolver implements Resolve<Game> { | ||
constructor(private _gamesService: GamesService) { | ||
} | ||
|
||
resolve(route: ActivatedRouteSnapshot): Promise<Game> { | ||
let id = route.params['id']; | ||
return new Promise((resolve) => { | ||
this._gamesService.getById(id).subscribe(game => { | ||
if (game) { | ||
resolve(game) | ||
} else { | ||
resolve(new Game()) | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
import {Component} from '@angular/core'; | ||
import {RouteConfig} from '@angular/router-deprecated'; | ||
|
||
import {NeedsAuthentication} from '../../decorators/needsAuthentication'; | ||
import {GameDetailsComponent} from './details'; | ||
import {GameListComponent} from './list'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'games', | ||
templateUrl: 'games.html' | ||
}) | ||
@RouteConfig([ | ||
{ path: '/', component: GameListComponent, name: 'GamesList', useAsDefault: true, data: { displayName: 'Game overview' } }, | ||
{ path: '/create', component: GameDetailsComponent, name: 'CreateGame', data: { displayName: 'Create a new game' } }, | ||
{ path: '/details/:id', component: GameDetailsComponent, name: 'GameDetails', data: { displayName: 'Game details' } } | ||
]) | ||
@NeedsAuthentication() | ||
|
||
//todo: ROUTER | ||
//todo: @NeedsAuthentication() | ||
export class GamesComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {Routes, RouterModule} from '@angular/router'; | ||
import {GamesComponent} from './games'; | ||
import {AuthGuard} from '../../guards/authGuard'; | ||
import {GameDetailsComponent} from './details'; | ||
import {GameListComponent} from './list'; | ||
import {ModuleWithProviders} from '@angular/core'; | ||
import {GameDetailsResolver} from './gameDetailsResolver'; | ||
|
||
const gameRoutes: Routes = [ | ||
|
||
{ | ||
path: 'games', | ||
component: GamesComponent, | ||
canActivate: [AuthGuard], | ||
children: [ | ||
{ path: 'all', component: GameListComponent, data: { displayName: 'Game overview' } }, | ||
{ | ||
path: 'new', | ||
component: GameDetailsComponent, | ||
name: 'CreateGame', | ||
data: { displayName: 'Create a new game' } | ||
}, | ||
{ | ||
path: 'details/:id', | ||
component: GameDetailsComponent, | ||
name: 'GameDetails', | ||
resolve: { game: GameDetailsResolver }, | ||
data: { displayName: 'Game details' } | ||
} | ||
] | ||
} | ||
|
||
]; | ||
|
||
export const gamesRouting: ModuleWithProviders = RouterModule.forChild(gameRoutes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 16 additions & 8 deletions
24
src/BoardZ/app/components/notifications/notifications.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<h1>Notification test sender</h1> | ||
<h3>Test Notifications</h3> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<form class="form-inline"> | ||
<label for="message">Message: </label> | ||
<input type="text" size="20" class="form-control" id="message" placeholder="Your message" #msg required /> | ||
<label> Send as: </label> | ||
<button type="button" class="btn btn-info btn-default" (click)="notificationService.notifyInformation(msg.value)">Info</button> | ||
<button type="button" class="btn btn-success btn-default" (click)="notificationService.notifySuccess(msg.value)">Success</button> | ||
<button type="button" class="btn btn-warning btn-default" (click)="notificationService.notifyWarning(msg.value)">Warning</button> | ||
<button type="button" class="btn btn-danger btn-default" (click)="notificationService.notifyError(msg.value)">Error</button> | ||
<input type="text" size="20" class="form-control" id="message" placeholder="Your message" #msg required/> | ||
<div> Send as: </div> | ||
<button type="button" class="btn btn-info btn-default" | ||
(click)="notificationService.notifyInformation(msg.value)">Info | ||
</button> | ||
<button type="button" class="btn btn-success btn-default" | ||
(click)="notificationService.notifySuccess(msg.value)">Success | ||
</button> | ||
<button type="button" class="btn btn-warning btn-default" | ||
(click)="notificationService.notifyWarning(msg.value)">Warning | ||
</button> | ||
<button type="button" class="btn btn-danger btn-default" | ||
(click)="notificationService.notifyError(msg.value)">Error | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.