1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

The rest of 1-21 changes. Mostly visual flow between tournament school and wrestlers

This commit is contained in:
Jacob Cody Wimer
2014-01-21 21:43:48 -05:00
parent 1112699025
commit 73d22a126a
10 changed files with 62 additions and 24 deletions

View File

@@ -1,13 +0,0 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/

View File

@@ -16,6 +16,9 @@ class SchoolsController < ApplicationController
# GET /schools/new
def new
@school = School.new
if params[:tournament]
@tournament = params[:tournament]
end
end
# GET /schools/1/edit
@@ -70,6 +73,6 @@ class SchoolsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def school_params
params.require(:school).permit(:name, :score)
params.require(:school).permit(:name, :score, :tournament_id)
end
end

View File

@@ -1,6 +1,7 @@
class StaticPagesController < ApplicationController
def index
@tournaments = Tournament.all
end
def school

View File

@@ -1,3 +1,4 @@
class School < ActiveRecord::Base
belongs_to :tournament
has_many :wrestlers
end

View File

@@ -10,9 +10,7 @@
<body>
<%= render 'layouts/header' %>
<div class="container">
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>

View File

@@ -19,6 +19,19 @@
<%= f.label :score %><br>
<%= f.number_field :score %>
</div>
<% if @school %>
<%= f.hidden_field :tournament_id, :value => @tournament %>
<% else %>
<div class="field">
<%= f.label 'Tournament' %><br>
<%= f.collection_select :tournament_id, Tournament.all, :id, :name %>
</div>
<% end %>
<div class="actions">
<%= f.submit %>
</div>

View File

@@ -10,6 +10,11 @@
<%= @school.score %>
</p>
<p>
<strong>Tournament:</strong>
<%= Tournament.find(@school.tournament_id).name %>
</p>
<%= link_to "Edit #{@school.name}", edit_school_path(@school) %> |
<%= link_to 'Back to Schools', schools_path %> |
<%= link_to 'Back to Admin', '/admin/index' %>

View File

@@ -1,7 +1,25 @@
<h1>CCHS Wrestling</h1>
<h3>1st Annual Comet Classic</h3>
<p>Central Crossing High School</p>
<p>4500 Big Run South Rd, Grove City, OH</p>
<h1>Pick A Tournament</h1>
<%= link_to 'New Tournament', new_tournament_path, :class=>"btn" %>
</br>
</br>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
<% @tournaments.each do |tournament| %>
<tr>
<td><%= tournament.name %></td>
<td><%= link_to 'Show', tournament, :class=>"btn" %><%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn" %><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<br>
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Central+Crossing+High+School,+Big+Run+South+Road,+Grove+City,+OH&amp;aq=0&amp;oq=central+crossing&amp;sll=40.365277,-82.669252&amp;sspn=4.888292,10.821533&amp;t=h&amp;ie=UTF8&amp;hq=Central+Crossing+High+School,+Big+Run+South+Road,+Grove+City,+OH&amp;ll=39.89637,-83.113117&amp;spn=0.019228,0.042272&amp;z=14&amp;iwloc=A&amp;cid=10210402163347601240&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Central+Crossing+High+School,+Big+Run+South+Road,+Grove+City,+OH&amp;aq=0&amp;oq=central+crossing&amp;sll=40.365277,-82.669252&amp;sspn=4.888292,10.821533&amp;t=h&amp;ie=UTF8&amp;hq=Central+Crossing+High+School,+Big+Run+South+Road,+Grove+City,+OH&amp;ll=39.89637,-83.113117&amp;spn=0.019228,0.042272&amp;z=14&amp;iwloc=A&amp;cid=10210402163347601240" style="color:#0000FF;text-align:left">View Larger Map</a></small>

View File

@@ -1,4 +1,6 @@
Wrestling::Application.routes.draw do
resources :tournaments
resources :schools
resources :weights

View File

@@ -11,13 +11,23 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20131231135039) do
ActiveRecord::Schema.define(version: 20140121020833) do
create_table "schools", force: true do |t|
t.string "name"
t.integer "score"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "tournament_id"
end
create_table "tournaments", force: true do |t|
t.string "name"
t.string "address"
t.string "director"
t.string "director_email"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "weights", force: true do |t|