Modifying the mash tournament schema a touch and adding a slew of scaffold-y stuff

This commit is contained in:
Dan Buch
2012-03-09 08:11:54 -05:00
parent d4dda1e9d8
commit 1fa4ffbe65
19 changed files with 399 additions and 245 deletions

View File

@@ -0,0 +1,85 @@
class MashTournamentsController < ApplicationController
# GET /mash_tournaments
# GET /mash_tournaments.xml
def index
@mash_tournaments = MashTournament.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mash_tournaments }
end
end
# GET /mash_tournaments/1
# GET /mash_tournaments/1.xml
def show
@mash_tournament = MashTournament.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mash_tournament }
end
end
# GET /mash_tournaments/new
# GET /mash_tournaments/new.xml
def new
@mash_tournament = MashTournament.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mash_tournament }
end
end
# GET /mash_tournaments/1/edit
def edit
@mash_tournament = MashTournament.find(params[:id])
end
# POST /mash_tournaments
# POST /mash_tournaments.xml
def create
@mash_tournament = MashTournament.new(params[:mash_tournament])
respond_to do |format|
if @mash_tournament.save
flash[:notice] = 'MashTournament was successfully created.'
format.html { redirect_to(@mash_tournament) }
format.xml { render :xml => @mash_tournament, :status => :created, :location => @mash_tournament }
else
format.html { render :action => "new" }
format.xml { render :xml => @mash_tournament.errors, :status => :unprocessable_entity }
end
end
end
# PUT /mash_tournaments/1
# PUT /mash_tournaments/1.xml
def update
@mash_tournament = MashTournament.find(params[:id])
respond_to do |format|
if @mash_tournament.update_attributes(params[:mash_tournament])
flash[:notice] = 'MashTournament was successfully updated.'
format.html { redirect_to(@mash_tournament) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @mash_tournament.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /mash_tournaments/1
# DELETE /mash_tournaments/1.xml
def destroy
@mash_tournament = MashTournament.find(params[:id])
@mash_tournament.destroy
respond_to do |format|
format.html { redirect_to(mash_tournaments_url) }
format.xml { head :ok }
end
end
end

View File

@@ -0,0 +1,2 @@
module MashTournamentsHelper
end

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>MashTournaments: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<p style="color: green"><%= flash[:notice] %></p>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1,12 @@
<h1>Editing mash_tournament</h1>
<% form_for(@mash_tournament) do |f| %>
<%= f.error_messages %>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @mash_tournament %> |
<%= link_to 'Back', mash_tournaments_path %>

View File

@@ -0,0 +1,18 @@
<h1>Listing mash_tournaments</h1>
<table>
<tr>
</tr>
<% @mash_tournaments.each do |mash_tournament| %>
<tr>
<td><%= link_to 'Show', mash_tournament %></td>
<td><%= link_to 'Edit', edit_mash_tournament_path(mash_tournament) %></td>
<td><%= link_to 'Destroy', mash_tournament, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New mash_tournament', new_mash_tournament_path %>

View File

@@ -0,0 +1,11 @@
<h1>New mash_tournament</h1>
<% form_for(@mash_tournament) do |f| %>
<%= f.error_messages %>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', mash_tournaments_path %>

View File

@@ -0,0 +1,3 @@
<%= link_to 'Edit', edit_mash_tournament_path(@mash_tournament) %> |
<%= link_to 'Back', mash_tournaments_path %>