summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-03-02 21:10:49 -0500
committerAndrewMurrell <amurrel@purdue.edu>2014-03-02 21:10:49 -0500
commitfefe3f469243d6c932c256cc8798bae35e4ff1c4 (patch)
tree7a413b2c3bcfb0cd6842c70ae0ff962b6908172c /app
parentc7469584f3fa51666d5df074d012741cbb2f3663 (diff)
Added Tournament Name.
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 e9f3c5a..984be3f 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)
+ params.require(:match).permit(:tournament_id, :name)
end
end
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb
index 34494c3..c5f1ba8 100644
--- a/app/views/matches/_form.html.erb
+++ b/app/views/matches/_form.html.erb
@@ -15,6 +15,10 @@
<%= f.label :tournament_id %><br>
<%= f.text_field :tournament_id %>
</div>
+ <div class="field">
+ <%= f.label :name %><br>
+ <%= f.text_field :name %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index d8122ac..0742770 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -4,6 +4,7 @@
<thead>
<tr>
<th>Tournament</th>
+ <th>Name</th>
<th></th>
<th></th>
<th></th>
@@ -14,6 +15,7 @@
<% @matches.each do |match| %>
<tr>
<td><%= match.tournament %></td>
+ <td><%= match.name %></td>
<td><%= link_to 'Show', match %></td>
<td><%= link_to 'Edit', edit_match_path(match) %></td>
<td><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %></td>
diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder
index c8ada7a..08ae0ef 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
+ json.extract! match, :id, :tournament_id, :name
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 7bab721..0b02ae7 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -5,5 +5,10 @@
<%= @match.tournament %>
</p>
+<p>
+ <strong>Name:</strong>
+ <%= @match.name %>
+</p>
+
<%= link_to 'Edit', edit_match_path(@match) %> |
<%= link_to 'Back', matches_path %>
diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder
index 2e45395..128550f 100644
--- a/app/views/matches/show.json.jbuilder
+++ b/app/views/matches/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @match, :id, :tournament_id, :created_at, :updated_at
+json.extract! @match, :id, :tournament_id, :name, :created_at, :updated_at