remove edit.html.erb
This commit is contained in:
parent
2c8c227493
commit
1d9a622303
|
@ -5,7 +5,7 @@ class MachinesController < ApplicationController
|
|||
|
||||
# GET /machines or /machines.json
|
||||
def index
|
||||
@machines = Machine.all
|
||||
@machines = Machine.order(:name)
|
||||
end
|
||||
|
||||
# GET /machines/1 or /machines/1.json
|
||||
|
@ -25,7 +25,7 @@ class MachinesController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @machine.save
|
||||
format.html { redirect_to machine_url(@machine), notice: 'Machine was successfully created.' }
|
||||
format.html { redirect_to machines_url, notice: 'Machine was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @machine }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
|
@ -38,10 +38,10 @@ class MachinesController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if @machine.update(machine_params)
|
||||
format.html { redirect_to machine_url(@machine), notice: 'Machine was successfully updated.' }
|
||||
format.html { redirect_to machines_url, notice: 'Machine was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @machine }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.html { render :show, status: :unprocessable_entity }
|
||||
format.json { render json: @machine.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class PlayersController < ApplicationController
|
|||
|
||||
# GET /players or /players.json
|
||||
def index
|
||||
@players = Player.all
|
||||
@players = Player.order(:name)
|
||||
end
|
||||
|
||||
# GET /players/1 or /players/1.json
|
||||
|
@ -16,16 +16,13 @@ class PlayersController < ApplicationController
|
|||
@player = Player.new
|
||||
end
|
||||
|
||||
# GET /players/1/edit
|
||||
def edit; end
|
||||
|
||||
# POST /players or /players.json
|
||||
def create
|
||||
@player = Player.new(player_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @player.save
|
||||
format.html { redirect_to player_url(@player), notice: 'Player was successfully created.' }
|
||||
format.html { redirect_to players_url, notice: 'Player was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @player }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
|
@ -38,10 +35,10 @@ class PlayersController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if @player.update(player_params)
|
||||
format.html { redirect_to player_url(@player), notice: 'Player was successfully updated.' }
|
||||
format.html { redirect_to players_url, notice: 'Player was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @player }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.html { render :show, status: :unprocessable_entity }
|
||||
format.json { render json: @player.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<%= link_to "Pins", machines_url %>
|
||||
<%= link_to "Players", players_url %>
|
||||
</nav>
|
||||
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
<div id="<%= dom_id machine %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= machine.name %>
|
||||
<%= link_to machine.name, machine %>
|
||||
<small><%= machine.edition %></small>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Edition:</strong>
|
||||
<%= machine.edition %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<h1>Editing machine</h1>
|
||||
|
||||
<%= render "form", machine: @machine %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this machine", @machine %> |
|
||||
<%= link_to "Back to machines", machines_path %>
|
||||
</div>
|
|
@ -1,13 +1,10 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Machines</h1>
|
||||
<h1>Pins</h1>
|
||||
|
||||
<div id="machines">
|
||||
<% @machines.each do |machine| %>
|
||||
<%= render machine %>
|
||||
<p>
|
||||
<%= link_to "Show this machine", machine %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @machine %>
|
||||
<%= render "form", machine: @machine %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this machine", edit_machine_path(@machine) %> |
|
||||
<%= link_to "Back to machines", machines_path %>
|
||||
|
||||
<%= button_to "Destroy this machine", @machine, method: :delete %>
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
<div id="<%= dom_id player %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= player.name %>
|
||||
<% if player.paid %>✓<% else %> <% end %>
|
||||
<%= link_to player.name, player %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Paid:</strong>
|
||||
<%= player.paid %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Strikes:</strong>
|
||||
<%= player.strikes %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<h1>Editing player</h1>
|
||||
|
||||
<%= render "form", player: @player %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this player", @player %> |
|
||||
<%= link_to "Back to players", players_path %>
|
||||
</div>
|
|
@ -5,9 +5,6 @@
|
|||
<div id="players">
|
||||
<% @players.each do |player| %>
|
||||
<%= render player %>
|
||||
<p>
|
||||
<%= link_to "Show this player", player %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @player %>
|
||||
<%= render "form", player: @player %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this player", edit_player_path(@player) %> |
|
||||
<%= link_to "Back to players", players_path %>
|
||||
|
||||
<%= button_to "Destroy this player", @player, method: :delete %>
|
||||
|
|
|
@ -22,7 +22,7 @@ class MachinesControllerTest < ActionDispatch::IntegrationTest
|
|||
post machines_url, params: { machine: { edition: @machine.edition, name: @machine.name } }
|
||||
end
|
||||
|
||||
assert_redirected_to machine_url(Machine.last)
|
||||
assert_redirected_to machines_url
|
||||
end
|
||||
|
||||
test 'should show machine' do
|
||||
|
@ -30,14 +30,9 @@ class MachinesControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_response :success
|
||||
end
|
||||
|
||||
test 'should get edit' do
|
||||
get edit_machine_url(@machine)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test 'should update machine' do
|
||||
patch machine_url(@machine), params: { machine: { edition: @machine.edition, name: @machine.name } }
|
||||
assert_redirected_to machine_url(@machine)
|
||||
assert_redirected_to machines_url
|
||||
end
|
||||
|
||||
test 'should destroy machine' do
|
||||
|
|
|
@ -22,7 +22,7 @@ class PlayersControllerTest < ActionDispatch::IntegrationTest
|
|||
post players_url, params: { player: { name: @player.name, paid: @player.paid, strikes: @player.strikes } }
|
||||
end
|
||||
|
||||
assert_redirected_to player_url(Player.last)
|
||||
assert_redirected_to players_url
|
||||
end
|
||||
|
||||
test 'should show player' do
|
||||
|
@ -30,14 +30,9 @@ class PlayersControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_response :success
|
||||
end
|
||||
|
||||
test 'should get edit' do
|
||||
get edit_player_url(@player)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test 'should update player' do
|
||||
patch player_url(@player), params: { player: { name: @player.name, paid: @player.paid, strikes: @player.strikes } }
|
||||
assert_redirected_to player_url(@player)
|
||||
assert_redirected_to players_url
|
||||
end
|
||||
|
||||
test 'should destroy player' do
|
||||
|
|
Loading…
Reference in New Issue