diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index 3192ec8..0000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -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 . - */ diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index 9c3a763..db80dd3 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -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 diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index c38239d..68317c3 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -1,6 +1,7 @@ class StaticPagesController < ApplicationController def index + @tournaments = Tournament.all end def school diff --git a/app/models/school.rb b/app/models/school.rb index 47f747a..3e3a80a 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -1,3 +1,4 @@ class School < ActiveRecord::Base + belongs_to :tournament has_many :wrestlers end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9bf2cae..9dbc116 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,9 +10,7 @@
<%= render 'layouts/header' %>+ Tournament: + <%= Tournament.find(@school.tournament_id).name %> +
+ <%= link_to "Edit #{@school.name}", edit_school_path(@school) %> | <%= link_to 'Back to Schools', schools_path %> | <%= link_to 'Back to Admin', '/admin/index' %> diff --git a/app/views/static_pages/index.html.erb b/app/views/static_pages/index.html.erb index 8aca099..20aa85c 100644 --- a/app/views/static_pages/index.html.erb +++ b/app/views/static_pages/index.html.erb @@ -1,7 +1,25 @@ -Central Crossing High School
-4500 Big Run South Rd, Grove City, OH
+| Name | ++ |
|---|---|
| <%= tournament.name %> | +<%= 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" %> | +