summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/tournaments_controller.rb4
-rw-r--r--app/views/tournaments/_form.html.erb4
-rw-r--r--app/views/tournaments/index.html.erb3
-rw-r--r--app/views/tournaments/index.json.jbuilder2
-rw-r--r--app/views/tournaments/show.html.erb5
-rw-r--r--app/views/tournaments/show.json.jbuilder2
6 files changed, 16 insertions, 4 deletions
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index 7352e8d..8d90758 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -124,6 +124,8 @@ class TournamentsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def tournament_params
- params.require(:tournament).permit(:game, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+
+ params.require(:tournament).permit(:game, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams)
+
end
end
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index d098cbb..38855a0 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -12,6 +12,10 @@
<% end %>
<div class="field">
+ <%= f.label :name %><br>
+ <%= f.text_field :name %>
+ </div>
+ <div class="field">
<%= f.label :game_id %><br>
<%= f.text_field :game_id %>
</div>
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index 7fb4a1d..90c3d7a 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -4,6 +4,7 @@
<table class="table table-hover">
<thead>
<tr>
+ <th>Name</th>
<th>Game</th>
<th>Status</th>
<th>Players per team</th>
@@ -18,7 +19,7 @@
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
- <td><%= tournament.id %></td>
+ <td><%= tournament.name %></td>
<td><% case tournament.status
when 0 %>
<%= form_tag(tournament_path(tournament), method: "put") do %>
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
index e95c6a7..4038f04 100644
--- a/app/views/tournaments/index.json.jbuilder
+++ b/app/views/tournaments/index.json.jbuilder
@@ -1,4 +1,4 @@
json.array!(@tournaments) do |tournament|
- json.extract! tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
+ json.extract! tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams
json.url tournament_url(tournament, format: :json)
end
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index 1f24f39..3de0623 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -15,6 +15,11 @@
<% if current_user.in_group?(:host) %>
<p>
+ <strong>Name:</strong>
+ <%= @tournament.name %>
+</p>
+
+<p>
<strong>Game:</strong>
<%= @tournament.id %>
</p>
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
index de2fbe0..27fd5c0 100644
--- a/app/views/tournaments/show.json.jbuilder
+++ b/app/views/tournaments/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @tournament, :id, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at
+json.extract! @tournament, :id, :name, :game_id, :status, :min_players_per_team, :max_players_per_team, :min_teams_per_match, :max_teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at