-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Primeros-pasos-angular' of https://github.com/CodeURJC-…
…DAW-2019-20/webapp9 into Primeros-pasos-angular
- Loading branch information
Showing
21 changed files
with
616 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { catchError } from 'rxjs/operators'; | ||
|
||
import { Player } from './player.model'; | ||
import { Team } from './team.model'; | ||
|
||
const BASE_URL = 'https://127.0.0.1:8443/api/player/'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class PlayersService { | ||
|
||
constructor(private httpClient: HttpClient){} | ||
|
||
getPlayerByUserId(userId: number): Observable<Player> { | ||
return this.httpClient.get(BASE_URL + userId).pipe( | ||
catchError(error => this.handleError(error)) | ||
)as Observable<Player>; | ||
} | ||
|
||
updatePlayerTeam(idPlayer: number, team: Team) { | ||
return this.httpClient.put(BASE_URL + idPlayer + "/team", team).pipe( | ||
catchError(error => this.handleError(error)) | ||
) | ||
} | ||
|
||
private handleError(error: any) { | ||
console.error(error); | ||
return Observable.throw("Server error (" + error.status + "): " + error.text()) | ||
} | ||
|
||
} |
160 changes: 160 additions & 0 deletions
160
Angular/lucia-no-te-enfades-pp/src/app/rocketleague/rocketleague.component.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 |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<html lang="en"> | ||
|
||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" | ||
content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<title>Rocket League</title> | ||
|
||
<!-- Bootstrap core CSS --> | ||
<link href="/core/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<link | ||
href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" | ||
rel="stylesheet" type="text/css"> | ||
|
||
<!-- Custom styles for this template --> | ||
<link href="/css/RocketLeague/landing-page.min.css" rel="stylesheet"> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<!-- NavBar --> | ||
<!-- | ||
<header> | ||
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> | ||
<a class="navbar-brand" href="#"> <img | ||
src="/imgs/Navbar/web-icon-white.png" width="30" height="30" alt=""> | ||
</a> <a class="navbar-brand">eTournaments</a> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" | ||
data-target="#navbarCollapse" aria-controls="navbarCollapse" | ||
aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarCollapse"> | ||
<ul class="navbar-nav mr-auto"> | ||
<li class="nav-item active"> | ||
<form action="index"> | ||
<input type="submit" class="nav-link" value="Home"> | ||
</form> | ||
</li> | ||
<li class="nav-item active">{{#noloaded}} | ||
<form action="login"> | ||
<input type="submit" class="nav-link" value="Sign In"> | ||
</form> {{/noloaded}} {{#adminNo}}{{^noloaded}} | ||
<form action="profile" method="get"> | ||
<input type="submit" class="nav-link" value="{{user.username}}"> | ||
<input type="hidden" name="_csrf" value="{{token}}" /> <input | ||
type="hidden" name="id" value="{{user.iduser}}" /> | ||
</form> {{/noloaded}} {{/adminNo}} | ||
</li> | ||
<li class="nav-item active"> | ||
<form action="leaderBoard"> | ||
<input type="submit" class="nav-link" value="Leaderboard"> | ||
</form> | ||
</li> | ||
{{#admin}} | ||
<li class="nav-item active"> | ||
<form action="tournamentCreation"> | ||
<input type="submit" class="nav-link" value="Create new tournament"> | ||
<input type="hidden" name="_csrf" value="{{token}}"> | ||
</form> | ||
</li> | ||
{{/admin}} | ||
</ul> | ||
<ul class="navbar-nav ml-auto"> | ||
<li class="nav-item active">{{#noloaded}} | ||
<form action="register"> | ||
<input type="submit" class="nav-link" value="Register"> <input | ||
type="hidden" name="_csrf" value="{{token}}" /> | ||
</form> {{/noloaded}} {{^noloaded}} | ||
<form action="/logout" method="post"> | ||
<input type="submit" class="nav-link" value="Log Out"> <input | ||
type="hidden" name="_csrf" value="{{token}}" /> | ||
</form> {{/noloaded}} | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> | ||
</header> | ||
--> | ||
|
||
<!-- Masthead --> | ||
<header class="masthead text-white text-center"> | ||
<div class="overlay"></div> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-xl-9 mx-auto"> | ||
<h1 class="mb-5">TOURNAMENTS</h1> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<!-- Icons Grid --> | ||
<section class="features-icons bg-light text-center"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-lg-4"> | ||
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3"> | ||
<i><a | ||
href="https://store.steampowered.com/app/252950/Rocket_League/"><img | ||
src="/imgs/Tournament/steam-Icon.png" alt="Responsive image" | ||
height="200px" width="200px" /></a></i> | ||
<h3>Download Rocket League on Steam</h3> | ||
</div> | ||
</div> | ||
<div class="col-lg-4"> | ||
<div class="features-icons-item mx-auto mb-5 mb-lg-0 mb-lg-3"> | ||
<i><a | ||
href="https://www.twitch.tv/directory/game/Rocket%20League"><img | ||
src="/imgs/Tournament/twitch-icon.png" height="200px" | ||
width="200px"></a></i> | ||
<h3>See on Twitch</h3> | ||
</div> | ||
</div> | ||
<div class="col-lg-4"> | ||
<div class="features-icons-item mx-auto mb-0 mb-lg-3"> | ||
<i> | ||
<form action="info"> | ||
<input type="image" src="/imgs/Tournament/info-icon.png" | ||
width="200px" height="200px" alt="submit"> | ||
</form> | ||
</i> | ||
<h3>Get more information about this game</h3> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<!-- Image Showcases --> | ||
<section class="showcase"> | ||
<div class="container-fluid p-0"> | ||
<ng-template ngFor let-elem [ngForOf]="tournaments"> | ||
<div class="row no-gutters"> | ||
<div class="col-lg-6 text-white showcase-img" | ||
style="background-image: url('/imgs/Tournament/defaultTournament.png');"></div> | ||
<div class="col-lg-6 my-auto showcase-text"> | ||
<h2>{{elem.name}} Tournament</h2> | ||
<p class="lead mb-0">{{elem.description}}</p> | ||
<div style="text-align: center"> | ||
<!--Aun no está cambiado no se si va aqui el action o en el component.ts--> | ||
<form action="/{{name}}"> | ||
<input type="submit" class="button" value="Go to tournament"> | ||
<input type="hidden" name="_csrf" value="{{token}}"> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</ng-template> | ||
</div> | ||
</section> | ||
</body> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
Angular/lucia-no-te-enfades-pp/src/app/rocketleague/rocketleague.component.ts
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,25 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { RocketleagueService } from './rocketleague.service'; | ||
|
||
import { Tournament } from '../tournament/tournament.model'; | ||
|
||
@Component({ | ||
selector: 'rocketleague', | ||
templateUrl:'./rocketleague.component.html' | ||
}) | ||
|
||
export class RocketleagueComponent{ | ||
tournament: Tournament; | ||
|
||
constructor(private rocketleagueService: RocketleagueService){} | ||
|
||
tournamentsOnHtml(){ | ||
this.rocketleagueService.getTournaments().subscribe( | ||
tournament => { | ||
let tournaments: any = tournament; | ||
}, | ||
error => console.error('Error finding tournaments ' + error) | ||
); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Angular/lucia-no-te-enfades-pp/src/app/rocketleague/rocketleague.service.ts
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,24 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { catchError } from 'rxjs/operators'; | ||
|
||
import { Tournament } from '../tournament/tournament.model'; | ||
|
||
const BASE_URL = 'https://127.0.0.1:8443/api/'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class RocketleagueService{ | ||
constructor(private httpClient: HttpClient){} | ||
|
||
getTournaments(): Observable<Tournament[]> { | ||
return this.httpClient.get(BASE_URL + './rocketleague.component.html').pipe( | ||
catchError(error => this.handleError(error)) | ||
) as Observable<Tournament[]>; | ||
} | ||
|
||
private handleError(error: any) { | ||
console.error(error); | ||
return Observable.throw("Server error (" + error.status + "): " + error.text()) | ||
} | ||
} |
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
Oops, something went wrong.