summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavisLWebb <davislwebb@ymail.com>2014-03-02 21:14:48 -0500
committerDavisLWebb <davislwebb@ymail.com>2014-03-02 21:14:48 -0500
commit31444c5a8cf56473a326227932dd36785c905ed1 (patch)
treed1398492d724eb4d9a32146e87596f7a0fb80622
parentec0ee835e8671fc5a421b7e7bcb54d4eec6deedb (diff)
parentfefe3f469243d6c932c256cc8798bae35e4ff1c4 (diff)
Merge branch 'master' of http://github.com/LukeShu/leaguer
-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/20140304020757_create_servers.rb (renamed from db/migrate/20140304020620_create_servers.rb)0
-rw-r--r--db/migrate/20140304020800_create_tournaments.rb (renamed from db/migrate/20140304020622_create_tournaments.rb)0
-rw-r--r--db/migrate/20140304020802_create_matches.rb (renamed from db/migrate/20140304020625_create_matches.rb)1
-rw-r--r--db/migrate/20140304020804_create_teams.rb (renamed from db/migrate/20140304020627_create_teams.rb)0
-rw-r--r--db/migrate/20140304020811_create_users.rb (renamed from db/migrate/20140304020633_create_users.rb)0
-rw-r--r--db/migrate/20140304020813_create_user_team_pairs.rb (renamed from db/migrate/20140304020636_create_user_team_pairs.rb)0
-rw-r--r--db/migrate/20140304020815_create_team_match_pairs.rb (renamed from db/migrate/20140304020638_create_team_match_pairs.rb)0
-rw-r--r--db/migrate/20140304020817_create_alerts.rb (renamed from db/migrate/20140304020640_create_alerts.rb)0
-rw-r--r--db/migrate/20140304020820_create_pms.rb (renamed from db/migrate/20140304020642_create_pms.rb)0
-rw-r--r--db/migrate/20140304020822_create_games.rb (renamed from db/migrate/20140304020645_create_games.rb)0
-rw-r--r--db/migrate/20140304020824_create_game_attributes.rb (renamed from db/migrate/20140304020647_create_game_attributes.rb)0
-rw-r--r--db/migrate/20140304020827_create_server_settings.rb (renamed from db/migrate/20140304020649_create_server_settings.rb)0
-rw-r--r--db/migrate/20140304020835_create_tournament_options.rb (renamed from db/migrate/20140304020658_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/20140304020620_create_servers.rb b/db/migrate/20140304020757_create_servers.rb
index f33241a..f33241a 100644
--- a/db/migrate/20140304020620_create_servers.rb
+++ b/db/migrate/20140304020757_create_servers.rb
diff --git a/db/migrate/20140304020622_create_tournaments.rb b/db/migrate/20140304020800_create_tournaments.rb
index 36fcf7e..36fcf7e 100644
--- a/db/migrate/20140304020622_create_tournaments.rb
+++ b/db/migrate/20140304020800_create_tournaments.rb
diff --git a/db/migrate/20140304020625_create_matches.rb b/db/migrate/20140304020802_create_matches.rb
index 6c0c157..325863d 100644
--- a/db/migrate/20140304020625_create_matches.rb
+++ b/db/migrate/20140304020802_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/20140304020627_create_teams.rb b/db/migrate/20140304020804_create_teams.rb
index dd8397d..dd8397d 100644
--- a/db/migrate/20140304020627_create_teams.rb
+++ b/db/migrate/20140304020804_create_teams.rb
diff --git a/db/migrate/20140304020633_create_users.rb b/db/migrate/20140304020811_create_users.rb
index f0986d4..f0986d4 100644
--- a/db/migrate/20140304020633_create_users.rb
+++ b/db/migrate/20140304020811_create_users.rb
diff --git a/db/migrate/20140304020636_create_user_team_pairs.rb b/db/migrate/20140304020813_create_user_team_pairs.rb
index 2c492ac..2c492ac 100644
--- a/db/migrate/20140304020636_create_user_team_pairs.rb
+++ b/db/migrate/20140304020813_create_user_team_pairs.rb
diff --git a/db/migrate/20140304020638_create_team_match_pairs.rb b/db/migrate/20140304020815_create_team_match_pairs.rb
index 8fac07e..8fac07e 100644
--- a/db/migrate/20140304020638_create_team_match_pairs.rb
+++ b/db/migrate/20140304020815_create_team_match_pairs.rb
diff --git a/db/migrate/20140304020640_create_alerts.rb b/db/migrate/20140304020817_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140304020640_create_alerts.rb
+++ b/db/migrate/20140304020817_create_alerts.rb
diff --git a/db/migrate/20140304020642_create_pms.rb b/db/migrate/20140304020820_create_pms.rb
index 93bb5c6..93bb5c6 100644
--- a/db/migrate/20140304020642_create_pms.rb
+++ b/db/migrate/20140304020820_create_pms.rb
diff --git a/db/migrate/20140304020645_create_games.rb b/db/migrate/20140304020822_create_games.rb
index 59d4ef0..59d4ef0 100644
--- a/db/migrate/20140304020645_create_games.rb
+++ b/db/migrate/20140304020822_create_games.rb
diff --git a/db/migrate/20140304020647_create_game_attributes.rb b/db/migrate/20140304020824_create_game_attributes.rb
index b63f134..b63f134 100644
--- a/db/migrate/20140304020647_create_game_attributes.rb
+++ b/db/migrate/20140304020824_create_game_attributes.rb
diff --git a/db/migrate/20140304020649_create_server_settings.rb b/db/migrate/20140304020827_create_server_settings.rb
index dfdd91b..dfdd91b 100644
--- a/db/migrate/20140304020649_create_server_settings.rb
+++ b/db/migrate/20140304020827_create_server_settings.rb
diff --git a/db/migrate/20140304020658_create_tournament_options.rb b/db/migrate/20140304020835_create_tournament_options.rb
index d2df22e..d2df22e 100644
--- a/db/migrate/20140304020658_create_tournament_options.rb
+++ b/db/migrate/20140304020835_create_tournament_options.rb
diff --git a/db/schema.rb b/db/schema.rb
index 4e4d940..5e2024b 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: 20140304020658) do
+ActiveRecord::Schema.define(version: 20140304020835) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -44,6 +44,7 @@ ActiveRecord::Schema.define(version: 20140304020658) 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 51546a1..766453e 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