Skip to content

Commit

Permalink
comienzo mustache para brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
luuromero97 committed Feb 20, 2020
1 parent 5567b40 commit 7f5775c
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 2 deletions.
23 changes: 23 additions & 0 deletions practica/src/main/java/com/practica/demo/Controlador.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.practica.demo;


import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.validation.ConstraintValidator;
Expand All @@ -22,6 +24,7 @@
import org.springframework.web.bind.annotation.RestController;

import com.practica.demo.data.Games;
import com.practica.demo.data.Tournament;
import com.practica.demo.data.user.RespositoryUser;
import com.practica.demo.data.user.User;
import com.practica.demo.data.user.UserComponent;
Expand All @@ -41,6 +44,9 @@ public Controlador() {
@Autowired
private RespositoryUser repositoruUser;

@Autowired
private TournamentRepository repositoryTournament;

@Autowired
private UserComponent userComponent;

Expand All @@ -59,6 +65,16 @@ public String goIndex(Model model) {

@RequestMapping("/tournaments")
public String goTournaments(Model model) {
//metodo para encontrar solo el nombre??
List <Tournament> listatorneo = repositoryTournament.findAll();

ArrayList<String> listaMostrar = new ArrayList<String>();

//for
listaMostrar.add(listatorneo.get(1).getName());
//

model.addAttribute("torneos",listatorneo);
return "rocketLeague";
}

Expand Down Expand Up @@ -130,6 +146,7 @@ public String register(Model model) {
return "register";
}


@PostMapping("/register")
public String newUser(Model model, User user,@RequestParam("confirm") String confirmpass) {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Expand All @@ -154,6 +171,12 @@ public String newUser(Model model, User user,@RequestParam("confirm") String con



}

@RequestMapping("/tournaments/{tournamentname}")
public String tournaments(Model model, @PathVariable String name) {

return "diamond";
}

private String generateUser(User user) {
Expand Down
13 changes: 13 additions & 0 deletions practica/src/main/java/com/practica/demo/TournamentRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.practica.demo;

import org.springframework.data.jpa.repository.JpaRepository;

import com.practica.demo.data.Tournament;
import com.practica.demo.data.user.User;

public interface TournamentRepository extends JpaRepository<Tournament, Integer>{

Tournament findByname(String name);


}
38 changes: 38 additions & 0 deletions practica/src/main/java/com/practica/demo/data/Tournament.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.practica.demo.data;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Tournament {
@Id
private int idTournament;

private int numTeams;
private String name;
private String description;

public int getIdTournament() {
return idTournament;
}
public void setIdTournament(int idTournament) {
this.idTournament = idTournament;
}
public int getNumTeams() {
return numTeams;
}
public void setNumTeams(int numTeams) {
this.numTeams = numTeams;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
2 changes: 1 addition & 1 deletion practica/src/main/resources/templates/diamond.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<header class="hero">
<div class="hero-wrap">
<p class="intro" id="intro">Rocket League</p>
<h1 id="headline">Diamonds Tournament</h1>
<h1 id="headline">{{tournamentname}}</h1>
<p class="year">2020</p>
<div style="text-align:center;">
<a><button class="button" type="button">Join tournament</button></a>
Expand Down
4 changes: 3 additions & 1 deletion practica/src/main/resources/templates/rocketLeague.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,18 @@ <h2>Champions Tournament</h2>
</div>
</div>
</div>
{{#torneos}}
<div class="row no-gutters">
<div class="col-lg-6 text-white showcase-img" style="background-image: url('/imgs/Tournament/diamond.jpg');"></div>
<div class="col-lg-6 my-auto showcase-text">
<h2>Diamonds Tournament</h2>
<p class="lead mb-0">Maybe it is a second division tournament, but that dont means it is less exciting. A lot of competivness is also guaranteed and future top players can here show their habilities and skills. Diamond 1 tier or higher is required to enter this tournament.</p>
<div style="text-align: center">
<a href="TournamentPage/diamond.html"><button class="button" type="button">Go to tournament</button></a>
<a href="TournamentPage/{{tournamentname}}"><button class="button" type="button">Go to tournament</button></a>
</div>
</div>
</div>
{{/torneos}}
<div class="row no-gutters">
<div class="col-lg-6 order-lg-2 text-white showcase-img" style="background-image: url('/imgs/Tournament/begginers.jpg');"></div>
<div class="col-lg-6 order-lg-1 my-auto showcase-text">
Expand Down

0 comments on commit 7f5775c

Please sign in to comment.