summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-03-25 17:47:32 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-03-25 17:47:32 -0400
commit433fc302fe2943e89a36657affea39d578475d20 (patch)
treeac22866f93f9353ab9c82978d2eac2fbe0927a4c /app
parent4e754e04d6bd04267e5a55011aa9f4f2a2fc7859 (diff)
Match Status added
Diffstat (limited to 'app')
-rw-r--r--app/controllers/matches_controller.rb2
-rw-r--r--app/views/matches/_form.html.erb4
-rw-r--r--app/views/matches/index.html.erb2
-rw-r--r--app/views/matches/index.json.jbuilder2
-rw-r--r--app/views/matches/show.html.erb5
-rw-r--r--app/views/matches/show.json.jbuilder2
6 files changed, 14 insertions, 3 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 8329da5..d79a7fc 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -69,6 +69,6 @@ class MatchesController < ApplicationController
# 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 f1e6047..727c002 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -12,6 +12,10 @@
<% end %>
<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 71db08c..400efb4 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>
@@ -15,6 +16,7 @@
<tbody>
<% @matches.each do |match| %>
<tr>
+ <td><%= match.status %></td>
<td><%= match.tournament %></td>
<td><%= match.name %></td>
<td><%= match.winner %></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 3abb1f7..f3fc822 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,6 +1,11 @@
<p id="notice"><%= notice %></p>
<p>
+ <strong>Status:</strong>
+ <%= @match.status %>
+</p>
+
+<p>
<strong>Tournament:</strong>
<%= @match.tournament %>
</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