-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaned up nifty scaffold views, as well as renamed order to
picks
- Loading branch information
James Trowbridge
committed
May 5, 2010
1 parent
26e6b06
commit 621a32f
Showing
25 changed files
with
8,133 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
class PicksController < ApplicationController | ||
def index | ||
@picks = Picks.all | ||
@picks = Pick.all | ||
end | ||
|
||
def show | ||
@picks = Picks.find(params[:id]) | ||
@pick = Pick.find(params[:id]) | ||
end | ||
|
||
def new | ||
@picks = Picks.new | ||
@pick = Pick.new | ||
end | ||
|
||
def create | ||
@picks = Picks.new(params[:picks]) | ||
if @picks.save | ||
flash[:notice] = "Successfully created picks." | ||
redirect_to @picks | ||
@pick = Pick.new(params[:pick]) | ||
if @pick.save | ||
flash[:notice] = "Successfully created pick." | ||
redirect_to @pick | ||
else | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@picks = Picks.find(params[:id]) | ||
@pick = Pick.find(params[:id]) | ||
end | ||
|
||
def update | ||
@picks = Picks.find(params[:id]) | ||
if @picks.update_attributes(params[:picks]) | ||
flash[:notice] = "Successfully updated picks." | ||
redirect_to @picks | ||
@pick = Pick.find(params[:id]) | ||
if @pick.update_attributes(params[:pick]) | ||
flash[:notice] = "Successfully updated pick." | ||
redirect_to @pick | ||
else | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@picks = Picks.find(params[:id]) | ||
@picks.destroy | ||
flash[:notice] = "Successfully destroyed picks." | ||
@pick = Pick.find(params[:id]) | ||
@pick.destroy | ||
flash[:notice] = "Successfully destroyed pick." | ||
redirect_to picks_url | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
class PlayersController < ApplicationController | ||
def index | ||
@players = Players.all | ||
@players = Player.all | ||
end | ||
|
||
def show | ||
@players = Players.find(params[:id]) | ||
@player = Player.find(params[:id]) | ||
end | ||
|
||
def new | ||
@players = Players.new | ||
@player = Player.new | ||
end | ||
|
||
def create | ||
@players = Players.new(params[:players]) | ||
if @players.save | ||
flash[:notice] = "Successfully created players." | ||
redirect_to @players | ||
@player = Player.new(params[:player]) | ||
if @player.save | ||
flash[:notice] = "Successfully created player." | ||
redirect_to @player | ||
else | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@players = Players.find(params[:id]) | ||
@player = Player.find(params[:id]) | ||
end | ||
|
||
def update | ||
@players = Players.find(params[:id]) | ||
if @players.update_attributes(params[:players]) | ||
flash[:notice] = "Successfully updated players." | ||
redirect_to @players | ||
@player = Player.find(params[:id]) | ||
if @player.update_attributes(params[:player]) | ||
flash[:notice] = "Successfully updated player." | ||
redirect_to @player | ||
else | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@players = Players.find(params[:id]) | ||
@players.destroy | ||
flash[:notice] = "Successfully destroyed players." | ||
@player = Player.find(params[:id]) | ||
@player.destroy | ||
flash[:notice] = "Successfully destroyed player." | ||
redirect_to players_url | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
class TeamsController < ApplicationController | ||
def index | ||
@teams = Teams.all | ||
@teams = Team.all | ||
end | ||
|
||
def show | ||
@teams = Teams.find(params[:id]) | ||
@team = Team.find(params[:id]) | ||
end | ||
|
||
def new | ||
@teams = Teams.new | ||
@team = Team.new | ||
end | ||
|
||
def create | ||
@teams = Teams.new(params[:teams]) | ||
if @teams.save | ||
flash[:notice] = "Successfully created teams." | ||
redirect_to @teams | ||
@team = Team.new(params[:team]) | ||
if @team.save | ||
flash[:notice] = "Successfully created team." | ||
redirect_to @team | ||
else | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@teams = Teams.find(params[:id]) | ||
@team = Team.find(params[:id]) | ||
end | ||
|
||
def update | ||
@teams = Teams.find(params[:id]) | ||
if @teams.update_attributes(params[:teams]) | ||
flash[:notice] = "Successfully updated teams." | ||
redirect_to @teams | ||
@team = Team.find(params[:id]) | ||
if @team.update_attributes(params[:team]) | ||
flash[:notice] = "Successfully updated team." | ||
redirect_to @team | ||
else | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@teams = Teams.find(params[:id]) | ||
@teams.destroy | ||
flash[:notice] = "Successfully destroyed teams." | ||
@team = Team.find(params[:id]) | ||
@team.destroy | ||
flash[:notice] = "Successfully destroyed team." | ||
redirect_to teams_url | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module PicksHelper | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
<% form_for @picks do |f| %> | ||
<% form_for @pick do |f| %> | ||
<%= f.error_messages %> | ||
<p> | ||
<%= f.label :name %><br /> | ||
<%= f.text_field :name %> | ||
<%= f.label :round %><br /> | ||
<%= f.text_field :round %> | ||
</p> | ||
<p> | ||
<%= f.label :pick_number %><br /> | ||
<%= f.text_field :pick_number %> | ||
</p> | ||
<p> | ||
<%= f.label :team_id %><br /> | ||
<%= f.text_field :team_id %> | ||
</p> | ||
<p> | ||
<%= f.label :player_id %><br /> | ||
<%= f.text_field :player_id %> | ||
</p> | ||
<p><%= f.submit "Submit" %></p> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<% title "Edit Picks" %> | ||
<% title "Edit Pick" %> | ||
|
||
<%= render :partial => 'form' %> | ||
|
||
<p> | ||
<%= link_to "Show", @picks %> | | ||
<%= link_to "Show", @pick %> | | ||
<%= link_to "View All", picks_path %> | ||
</p> |
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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
<% title "Picks" %> | ||
<% @picks.each do |pick| %> | ||
<h1> | ||
<%= pick.round %> | ||
<%= pick.pick_number %> | ||
<%= pick.team.name %> | ||
<%= link_to "Show", pick %> | ||
<%= link_to "Edit", edit_pick_path(pick) %> | ||
<%= link_to "Destroy", pick, :confirm => 'Are you sure?', :method => :delete %> | ||
</h1> | ||
<% end %> | ||
|
||
<table> | ||
<tr> | ||
<th>Name</th> | ||
</tr> | ||
<% for picks in @picks %> | ||
<tr> | ||
<td><%=h picks.name %></td> | ||
<td><%= link_to "Show", picks %></td> | ||
<td><%= link_to "Edit", edit_picks_path(picks) %></td> | ||
<td><%= link_to "Destroy", picks, :confirm => 'Are you sure?', :method => :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<p><%= link_to "New Picks", new_picks_path %></p> | ||
<p><%= link_to "New Pick", new_pick_path %></p> |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<% title "New Picks" %> | ||
<% title "New Pick" %> | ||
|
||
<%= render :partial => 'form' %> | ||
|
||
|
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 |
---|---|---|
@@ -1,12 +1,24 @@ | ||
<% title "Picks" %> | ||
<% title "Pick" %> | ||
|
||
<p> | ||
<strong>Name:</strong> | ||
<%=h @picks.name %> | ||
<strong>Round:</strong> | ||
<%=h @pick.round %> | ||
</p> | ||
<p> | ||
<strong>Pick Number:</strong> | ||
<%=h @pick.pick_number %> | ||
</p> | ||
<p> | ||
<strong>Team:</strong> | ||
<%=h @pick.team_id %> | ||
</p> | ||
<p> | ||
<strong>Player:</strong> | ||
<%=h @pick.player_id %> | ||
</p> | ||
|
||
<p> | ||
<%= link_to "Edit", edit_picks_path(@picks) %> | | ||
<%= link_to "Destroy", @picks, :confirm => 'Are you sure?', :method => :delete %> | | ||
<%= link_to "Edit", edit_pick_path(@pick) %> | | ||
<%= link_to "Destroy", @pick, :confirm => 'Are you sure?', :method => :delete %> | | ||
<%= link_to "View All", picks_path %> | ||
</p> |
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 |
---|---|---|
@@ -1,8 +1,28 @@ | ||
<% form_for @players do |f| %> | ||
<% form_for @player do |f| %> | ||
<%= f.error_messages %> | ||
<p> | ||
<%= f.label :name %><br /> | ||
<%= f.text_field :name %> | ||
</p> | ||
<p> | ||
<%= f.label :position %><br /> | ||
<%= f.text_field :position %> | ||
</p> | ||
<p> | ||
<%= f.label :drafted %><br /> | ||
<%= f.check_box :drafted %> | ||
</p> | ||
<p> | ||
<%= f.label :pick %><br /> | ||
<%= f.text_field :pick %> | ||
</p> | ||
<p> | ||
<%= f.label :team_id %><br /> | ||
<%= f.text_field :team_id %> | ||
</p> | ||
<p> | ||
<%= f.label :pick_id %><br /> | ||
<%= f.text_field :pick_id %> | ||
</p> | ||
<p><%= f.submit "Submit" %></p> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<% title "Edit Players" %> | ||
<% title "Edit Player" %> | ||
|
||
<%= render :partial => 'form' %> | ||
|
||
<p> | ||
<%= link_to "Show", @players %> | | ||
<%= link_to "Show", @player %> | | ||
<%= link_to "View All", players_path %> | ||
</p> |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<% title "New Players" %> | ||
<% title "New Player" %> | ||
|
||
<%= render :partial => 'form' %> | ||
|
||
|
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
<% title "Players" %> | ||
<% title "Player" %> | ||
|
||
<p> | ||
<strong>Name:</strong> | ||
<%=h @players.name %> | ||
<%=h @player.name %> | ||
</p> | ||
<p> | ||
<strong>Position:</strong> | ||
<%=h @player.position %> | ||
</p> | ||
<p> | ||
<strong>Drafted:</strong> | ||
<%=h @player.drafted %> | ||
</p> | ||
<p> | ||
<strong>Pick:</strong> | ||
<%=h @player.pick %> | ||
</p> | ||
<p> | ||
<strong>Team:</strong> | ||
<%=h @player.team_id %> | ||
</p> | ||
<p> | ||
<strong>Pick:</strong> | ||
<%=h @player.pick_id %> | ||
</p> | ||
|
||
<p> | ||
<%= link_to "Edit", edit_players_path(@players) %> | | ||
<%= link_to "Destroy", @players, :confirm => 'Are you sure?', :method => :delete %> | | ||
<%= link_to "Edit", edit_player_path(@player) %> | | ||
<%= link_to "Destroy", @player, :confirm => 'Are you sure?', :method => :delete %> | | ||
<%= link_to "View All", players_path %> | ||
</p> |
Oops, something went wrong.