diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/matches_controller.rb | 2 | ||||
-rw-r--r-- | app/views/matches/_form.html.erb | 4 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 3 | ||||
-rw-r--r-- | app/views/matches/index.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/matches/show.html.erb | 5 | ||||
-rw-r--r-- | app/views/matches/show.json.jbuilder | 2 |
6 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 1f0d964..b312e9e 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -72,6 +72,6 @@ class MatchesController < ApplicationController end # Never trust parameters from the scary internet, only allow the white list through. def match_params - params.require(:match).permit(:tournament_id, :name, :winner_id) + params.require(:match).permit(:status, :tournament_id, :name, :winner_id) end end diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index 015aed0..3efb566 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -1,6 +1,10 @@ <%= form_for([@tournament, @tournament.matches.build]) do |f| %> <div class="field"> + <%= f.label :status %><br> + <%= f.number_field :status %> + </div> + <div class="field"> <%= f.label :tournament_id %><br> <%= f.text_field :tournament_id %> </div> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 60df1b5..d862d57 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -3,6 +3,7 @@ <table> <thead> <tr> + <th>Status</th> <th>Tournament</th> <th>Name</th> <th>Winner</th> @@ -16,6 +17,8 @@ <% @tournament.matches.each do |match| %> <tr> <td><%= match.tournament.id %></td> + <td><%= match.status %></td> + <td><%= match.tournament %></td> <td><%= match.name %></td> <td><%= match.winner %></td> <td><%= link_to 'Show', tournament_match_path(@tournament, match) %></td> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index 0b2bfcd..1a63f5f 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id, :tournament_id, :name, :winner_id + json.extract! match, :id, :status, :tournament_id, :name, :winner_id json.url match_url(match, format: :json) end diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index b6930ea..6b962ad 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,4 +1,9 @@ <p> + <strong>Status:</strong> + <%= @match.status %> +</p> + +<p> <strong>Tournament:</strong> <%= @match.tournament.id %> </p> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index fe14010..a3ef588 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :tournament_id, :name, :winner_id, :created_at, :updated_at +json.extract! @match, :id, :status, :tournament_id, :name, :winner_id, :created_at, :updated_at |