summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--db/migrate/20140304020709_create_servers.rb (renamed from db/migrate/20140304020531_create_servers.rb)0
-rw-r--r--db/migrate/20140304020711_create_tournaments.rb (renamed from db/migrate/20140304020533_create_tournaments.rb)0
-rw-r--r--db/migrate/20140304020713_create_matches.rb (renamed from db/migrate/20140304020536_create_matches.rb)1
-rw-r--r--db/migrate/20140304020716_create_teams.rb (renamed from db/migrate/20140304020538_create_teams.rb)0
-rw-r--r--db/migrate/20140304020722_create_users.rb (renamed from db/migrate/20140304020545_create_users.rb)0
-rw-r--r--db/migrate/20140304020724_create_user_team_pairs.rb (renamed from db/migrate/20140304020547_create_user_team_pairs.rb)0
-rw-r--r--db/migrate/20140304020727_create_team_match_pairs.rb (renamed from db/migrate/20140304020549_create_team_match_pairs.rb)0
-rw-r--r--db/migrate/20140304020729_create_alerts.rb (renamed from db/migrate/20140304020551_create_alerts.rb)0
-rw-r--r--db/migrate/20140304020731_create_pms.rb (renamed from db/migrate/20140304020554_create_pms.rb)0
-rw-r--r--db/migrate/20140304020733_create_games.rb (renamed from db/migrate/20140304020556_create_games.rb)0
-rw-r--r--db/migrate/20140304020736_create_game_attributes.rb (renamed from db/migrate/20140304020558_create_game_attributes.rb)0
-rw-r--r--db/migrate/20140304020738_create_server_settings.rb (renamed from db/migrate/20140304020601_create_server_settings.rb)0
-rw-r--r--db/migrate/20140304020747_create_tournament_options.rb (renamed from db/migrate/20140304020609_create_tournament_options.rb)0
-rw-r--r--db/schema.rb3
-rwxr-xr-xgenerate.sh2
-rw-r--r--spec/views/matches/edit.html.erb_spec.rb4
-rw-r--r--spec/views/matches/index.html.erb_spec.rb7
-rw-r--r--spec/views/matches/new.html.erb_spec.rb4
-rw-r--r--spec/views/matches/show.html.erb_spec.rb4
25 files changed, 32 insertions, 10 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
diff --git a/db/migrate/20140304020531_create_servers.rb b/db/migrate/20140304020709_create_servers.rb
index f33241a..f33241a 100644
--- a/db/migrate/20140304020531_create_servers.rb
+++ b/db/migrate/20140304020709_create_servers.rb
diff --git a/db/migrate/20140304020533_create_tournaments.rb b/db/migrate/20140304020711_create_tournaments.rb
index 36fcf7e..36fcf7e 100644
--- a/db/migrate/20140304020533_create_tournaments.rb
+++ b/db/migrate/20140304020711_create_tournaments.rb
diff --git a/db/migrate/20140304020536_create_matches.rb b/db/migrate/20140304020713_create_matches.rb
index 6c0c157..325863d 100644
--- a/db/migrate/20140304020536_create_matches.rb
+++ b/db/migrate/20140304020713_create_matches.rb
@@ -2,6 +2,7 @@ class CreateMatches < ActiveRecord::Migration
def change
create_table :matches do |t|
t.references :tournament, index: true
+ t.string :name
t.timestamps
end
diff --git a/db/migrate/20140304020538_create_teams.rb b/db/migrate/20140304020716_create_teams.rb
index dd8397d..dd8397d 100644
--- a/db/migrate/20140304020538_create_teams.rb
+++ b/db/migrate/20140304020716_create_teams.rb
diff --git a/db/migrate/20140304020545_create_users.rb b/db/migrate/20140304020722_create_users.rb
index f0986d4..f0986d4 100644
--- a/db/migrate/20140304020545_create_users.rb
+++ b/db/migrate/20140304020722_create_users.rb
diff --git a/db/migrate/20140304020547_create_user_team_pairs.rb b/db/migrate/20140304020724_create_user_team_pairs.rb
index 2c492ac..2c492ac 100644
--- a/db/migrate/20140304020547_create_user_team_pairs.rb
+++ b/db/migrate/20140304020724_create_user_team_pairs.rb
diff --git a/db/migrate/20140304020549_create_team_match_pairs.rb b/db/migrate/20140304020727_create_team_match_pairs.rb
index 8fac07e..8fac07e 100644
--- a/db/migrate/20140304020549_create_team_match_pairs.rb
+++ b/db/migrate/20140304020727_create_team_match_pairs.rb
diff --git a/db/migrate/20140304020551_create_alerts.rb b/db/migrate/20140304020729_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140304020551_create_alerts.rb
+++ b/db/migrate/20140304020729_create_alerts.rb
diff --git a/db/migrate/20140304020554_create_pms.rb b/db/migrate/20140304020731_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140304020554_create_pms.rb
+++ b/db/migrate/20140304020731_create_pms.rb
diff --git a/db/migrate/20140304020556_create_games.rb b/db/migrate/20140304020733_create_games.rb
index 59d4ef0..59d4ef0 100644
--- a/db/migrate/20140304020556_create_games.rb
+++ b/db/migrate/20140304020733_create_games.rb
diff --git a/db/migrate/20140304020558_create_game_attributes.rb b/db/migrate/20140304020736_create_game_attributes.rb
index b63f134..b63f134 100644
--- a/db/migrate/20140304020558_create_game_attributes.rb
+++ b/db/migrate/20140304020736_create_game_attributes.rb
diff --git a/db/migrate/20140304020601_create_server_settings.rb b/db/migrate/20140304020738_create_server_settings.rb
index dfdd91b..dfdd91b 100644
--- a/db/migrate/20140304020601_create_server_settings.rb
+++ b/db/migrate/20140304020738_create_server_settings.rb
diff --git a/db/migrate/20140304020609_create_tournament_options.rb b/db/migrate/20140304020747_create_tournament_options.rb
index d2df22e..d2df22e 100644
--- a/db/migrate/20140304020609_create_tournament_options.rb
+++ b/db/migrate/20140304020747_create_tournament_options.rb
diff --git a/db/schema.rb b/db/schema.rb
index 847a686..9069230 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140304020609) do
+ActiveRecord::Schema.define(version: 20140304020747) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -44,6 +44,7 @@ ActiveRecord::Schema.define(version: 20140304020609) do
create_table "matches", force: true do |t|
t.integer "tournament_id"
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
diff --git a/generate.sh b/generate.sh
index ea96b9b..336ea5b 100755
--- a/generate.sh
+++ b/generate.sh
@@ -15,7 +15,7 @@ NOTEST='--skip-test-unit'
set -x
bundle exec rails generate scaffold server --force $NOTEST
bundle exec rails generate scaffold tournament game:references --force $NOTEST
-bundle exec rails generate scaffold match tournament:references --force $NOTEST
+bundle exec rails generate scaffold match tournament:references name:string --force $NOTEST
bundle exec rails generate scaffold team $NOTEST
bundle exec rails generate controller users $NOTEST
bundle exec rails generate controller Sessions
diff --git a/spec/views/matches/edit.html.erb_spec.rb b/spec/views/matches/edit.html.erb_spec.rb
index 0f7c673..fca468f 100644
--- a/spec/views/matches/edit.html.erb_spec.rb
+++ b/spec/views/matches/edit.html.erb_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
describe "matches/edit" do
before(:each) do
@match = assign(:match, stub_model(Match,
- :tournament => nil
+ :tournament => nil,
+ :name => "MyString"
))
end
@@ -13,6 +14,7 @@ describe "matches/edit" do
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", match_path(@match), "post" do
assert_select "input#match_tournament[name=?]", "match[tournament]"
+ assert_select "input#match_name[name=?]", "match[name]"
end
end
end
diff --git a/spec/views/matches/index.html.erb_spec.rb b/spec/views/matches/index.html.erb_spec.rb
index e920f16..d3be1b5 100644
--- a/spec/views/matches/index.html.erb_spec.rb
+++ b/spec/views/matches/index.html.erb_spec.rb
@@ -4,10 +4,12 @@ describe "matches/index" do
before(:each) do
assign(:matches, [
stub_model(Match,
- :tournament => nil
+ :tournament => nil,
+ :name => "Name"
),
stub_model(Match,
- :tournament => nil
+ :tournament => nil,
+ :name => "Name"
)
])
end
@@ -16,5 +18,6 @@ describe "matches/index" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "tr>td", :text => nil.to_s, :count => 2
+ assert_select "tr>td", :text => "Name".to_s, :count => 2
end
end
diff --git a/spec/views/matches/new.html.erb_spec.rb b/spec/views/matches/new.html.erb_spec.rb
index c3537dc..4423d2c 100644
--- a/spec/views/matches/new.html.erb_spec.rb
+++ b/spec/views/matches/new.html.erb_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
describe "matches/new" do
before(:each) do
assign(:match, stub_model(Match,
- :tournament => nil
+ :tournament => nil,
+ :name => "MyString"
).as_new_record)
end
@@ -13,6 +14,7 @@ describe "matches/new" do
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", matches_path, "post" do
assert_select "input#match_tournament[name=?]", "match[tournament]"
+ assert_select "input#match_name[name=?]", "match[name]"
end
end
end
diff --git a/spec/views/matches/show.html.erb_spec.rb b/spec/views/matches/show.html.erb_spec.rb
index 4460feb..642119d 100644
--- a/spec/views/matches/show.html.erb_spec.rb
+++ b/spec/views/matches/show.html.erb_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
describe "matches/show" do
before(:each) do
@match = assign(:match, stub_model(Match,
- :tournament => nil
+ :tournament => nil,
+ :name => "Name"
))
end
@@ -11,5 +12,6 @@ describe "matches/show" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
rendered.should match(//)
+ rendered.should match(/Name/)
end
end