-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing 'game' model to 'table' model to better encapsulate concepts
now we have a game_type for a table
- Loading branch information
Ben Feigin
committed
Feb 16, 2012
1 parent
365a9ff
commit 1013774
Showing
29 changed files
with
232 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# A sample Guardfile | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'rspec', :version => 2 do | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
|
||
# Rails example | ||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | ||
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } | ||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } | ||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } | ||
watch('config/routes.rb') { "spec/routing" } | ||
watch('app/controllers/application_controller.rb') { "spec/controllers" } | ||
# Capybara request specs | ||
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } | ||
end | ||
|
||
|
||
guard :bundler do | ||
watch('Gemfile') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Admin.controllers :tables do | ||
|
||
get :index do | ||
@tables = Game.all | ||
render 'tables/index' | ||
end | ||
|
||
get :new do | ||
@table = Game.new | ||
render 'tables/new' | ||
end | ||
|
||
post :create do | ||
@table = Game.new(params[:table]) | ||
if @table.save | ||
flash[:notice] = 'Game was successfully created.' | ||
redirect url(:tables, :edit, :id => @table.id) | ||
else | ||
render 'tables/new' | ||
end | ||
end | ||
|
||
get :edit, :with => :id do | ||
@table = Game.find(params[:id]) | ||
render 'tables/edit' | ||
end | ||
|
||
put :update, :with => :id do | ||
@table = Game.find(params[:id]) | ||
if @table.update_attributes(params[:table]) | ||
flash[:notice] = 'Game was successfully updated.' | ||
redirect url(:tables, :edit, :id => @table.id) | ||
else | ||
render 'tables/edit' | ||
end | ||
end | ||
|
||
delete :destroy, :with => :id do | ||
table = Game.find(params[:id]) | ||
if table.destroy | ||
flash[:notice] = 'Game was successfully destroyed.' | ||
else | ||
flash[:error] = 'Unable to destroy Game!' | ||
end | ||
redirect url(:tables, :index) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.block | ||
.secondary-navigation | ||
%ul.wat-cf | ||
%li.first=link_to pat(:list), url(:tables, :index) | ||
%li=link_to pat(:new), url(:tables, :new) | ||
%li.active=link_to pat(:edit), url(:tables, :edit, :id => @table.id) | ||
.content | ||
%h2.title | ||
=pat(:edit) | ||
=mt(:table) | ||
.inner | ||
-form_for :table, url(:tables, :update, :id => @table.id), :method => :put, :class => :form do |f| | ||
=partial "tables/form", :locals => { :f => f } | ||
|
||
-content_for :sidebar, partial("base/sidebar") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.block | ||
.secondary-navigation | ||
%ul.wat-cf | ||
%li.first.active=link_to pat(:list), url(:tables, :index) | ||
%li=link_to pat(:new), url(:tables, :new) | ||
.content | ||
%h2.title | ||
=pat(:all) | ||
=mt(:tables) | ||
.inner | ||
%table.table | ||
%tr | ||
%th.first=mat(:table, :id) | ||
%th=mat(:table, :tournament_id) | ||
%th=mat(:table, :betting_round) | ||
%th=mat(:table, :turn) | ||
%th=mat(:table, :action_to) | ||
%th.last=" " | ||
-@tables.each do |table| | ||
%tr | ||
%td.first=table.id | ||
%td=table.tournament_id | ||
%td=table.betting_round | ||
%td=table.turn | ||
%td=table.action_to | ||
%td.last | ||
=button_to pat(:edit), url(:tables, :edit, :id => table.id), :method => :get, :class => :button_to | ||
="|" | ||
=button_to pat(:delete), url(:tables, :destroy, :id => table.id), :method => :delete, :class => :button_to, :onsubmit => "return confirm('#{pat(:confirm)}')" | ||
.actions-bar.wat-cf | ||
.actions=" " | ||
|
||
-content_for :sidebar, partial("base/sidebar") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.block | ||
.secondary-navigation | ||
%ul.wat-cf | ||
%li.first=link_to pat(:list), url(:tables, :index) | ||
%li.active=link_to pat(:new), url(:tables, :new) | ||
.content | ||
%h2.title | ||
=pat(:new) | ||
=mt(:table) | ||
.inner | ||
-form_for :table, url(:tables, :create), :class => :form do |f| | ||
=partial "tables/form", :locals => { :f => f } | ||
|
||
-content_for :sidebar, partial("base/sidebar") |
Binary file not shown.
Empty file.
Oops, something went wrong.