diff --git a/app/assets/javascripts/admin.js.coffee b/app/assets/javascripts/admin.js.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/app/assets/javascripts/admin.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
diff --git a/app/assets/stylesheets/admin.css.scss b/app/assets/stylesheets/admin.css.scss
new file mode 100644
index 0000000..0f4f3b2
--- /dev/null
+++ b/app/assets/stylesheets/admin.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Admin controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
new file mode 100644
index 0000000..e200954
--- /dev/null
+++ b/app/controllers/admin_controller.rb
@@ -0,0 +1,5 @@
+class AdminController < ApplicationController
+ def index
+
+ end
+end
diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb
index 6e5986b..9c3a763 100644
--- a/app/controllers/schools_controller.rb
+++ b/app/controllers/schools_controller.rb
@@ -10,6 +10,7 @@ class SchoolsController < ApplicationController
# GET /schools/1
# GET /schools/1.json
def show
+ @wrestlers = Wrestler.all
end
# GET /schools/new
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
new file mode 100644
index 0000000..d5c6d35
--- /dev/null
+++ b/app/helpers/admin_helper.rb
@@ -0,0 +1,2 @@
+module AdminHelper
+end
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
new file mode 100644
index 0000000..f88aed6
--- /dev/null
+++ b/app/views/admin/index.html.erb
@@ -0,0 +1,6 @@
+<%= link_to "Go to Schools", '/schools/' %>
+
+<%= link_to "Go to Weights", '/weights/' %>
+
+<%= link_to "Go to Wrestlers", '/wrestlers/' %>
+
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 9748f79..febf613 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -8,6 +8,10 @@
<%= link_to "School Scores", '/static_pages/school' %>
<%= link_to "Brackets" , '#' %>
<%= link_to "Bout Board" , '#' %>
+ <% #If logged in %>
+ <%= link_to "Admin" , '/admin/index' %>
+ <% #ELSE %>
+ <%= link_to "Log In" , '#' %>
diff --git a/app/views/schools/index.html.erb b/app/views/schools/index.html.erb
index 975f718..f1720a4 100644
--- a/app/views/schools/index.html.erb
+++ b/app/views/schools/index.html.erb
@@ -1,13 +1,11 @@
Listing schools
-
+
| Name |
Score |
- |
- |
- |
+ Actions |
@@ -16,9 +14,7 @@
| <%= school.name %> |
<%= school.score %> |
- <%= link_to 'Show', school %> |
- <%= link_to 'Edit', edit_school_path(school) %> |
- <%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' } %> |
+ <%= link_to 'Show', school , :class=>"btn" %><%= link_to 'Edit', edit_school_path(school), :class=>"btn" %><%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> |
<% end %>
diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb
index f056da2..dcdd7ee 100644
--- a/app/views/schools/show.html.erb
+++ b/app/views/schools/show.html.erb
@@ -10,5 +10,37 @@
<%= @school.score %>
-<%= link_to 'Edit', edit_school_path(@school) %> |
-<%= link_to 'Back', schools_path %>
+<%= link_to "Edit #{@school.name}", edit_school_path(@school) %> |
+<%= link_to 'Back to Schools', schools_path %> |
+<%= link_to 'Back to Admin', '/admin/index' %>
+
+
+
+
+
+
+
+
+
+ | Name |
+ Weight |
+ Seed |
+ Original seed |
+ Actions |
+
+
+
+
+ <% @wrestlers.each do |wrestler| %>
+ <% if wrestler.school_id == @school.id %>
+
+ | <%= wrestler.name %> |
+ <%= Weight.find(wrestler.weight_id).max %> |
+ <%= wrestler.seed %> |
+ <%= wrestler.original_seed %> |
+ <%= link_to 'Show', wrestler , :class=>"btn" %><%= link_to 'Edit', edit_wrestler_path(wrestler), :class=>"btn" %><%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> |
+
+ <% end %>
+ <% end %>
+
+
diff --git a/app/views/weights/index.html.erb b/app/views/weights/index.html.erb
index 6b7e9d9..7a2d0c1 100644
--- a/app/views/weights/index.html.erb
+++ b/app/views/weights/index.html.erb
@@ -1,12 +1,10 @@
Listing weights
-
+
| Max |
- |
- |
- |
+ Actions |
@@ -14,9 +12,7 @@
<% @weights.each do |weight| %>
| <%= weight.max %> |
- <%= link_to 'Show', weight %> |
- <%= link_to 'Edit', edit_weight_path(weight) %> |
- <%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' } %> |
+ <%= link_to 'Show', weight, :class=>"btn" %><%= link_to 'Edit', edit_weight_path(weight), :class=>"btn" %><%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> |
<% end %>
diff --git a/app/views/weights/show.html.erb b/app/views/weights/show.html.erb
index e2dc586..b352e40 100644
--- a/app/views/weights/show.html.erb
+++ b/app/views/weights/show.html.erb
@@ -3,8 +3,9 @@
Weight Class:<%= @weight.max %>
-<%= link_to 'Edit Weight Class', edit_weight_path(@weight) %> |
-<%= link_to 'Back to Weight Classes', weights_path %>
+<%= link_to "Edit #{@weight.max} Weight Class", edit_weight_path(@weight) %> |
+<%= link_to 'Back to Weight Classes', weights_path %> |
+<%= link_to 'Back to Admin', '/admin/index' %>
diff --git a/app/views/wrestlers/index.html.erb b/app/views/wrestlers/index.html.erb
index d768e06..e88964c 100644
--- a/app/views/wrestlers/index.html.erb
+++ b/app/views/wrestlers/index.html.erb
@@ -1,31 +1,25 @@
Listing wrestlers
-
+
| Name |
- School |
Weight |
Seed |
Original seed |
- |
- |
- |
+ Actions |
<% @wrestlers.each do |wrestler| %>
-
- | <%= wrestler.name %> |
- <%= School.find(wrestler.school_id).name %> |
- <%= Weight.find(wrestler.weight_id).max %> |
- <%= wrestler.seed %> |
- <%= wrestler.original_seed %> |
- <%= link_to 'Show', wrestler %> |
- <%= link_to 'Edit', edit_wrestler_path(wrestler) %> |
- <%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' } %> |
-
+
+ | <%= wrestler.name %> |
+ <%= Weight.find(wrestler.weight_id).max %> |
+ <%= wrestler.seed %> |
+ <%= wrestler.original_seed %> |
+ <%= link_to 'Show', wrestler , :class=>"btn" %><%= link_to 'Edit', edit_wrestler_path(wrestler), :class=>"btn" %><%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> |
+
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 5988d49..f48894b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,6 +11,7 @@ Wrestling::Application.routes.draw do
# You can have the root of your site routed with "root"
root 'static_pages#index'
get 'static_pages/school'
+ get 'admin/index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
diff --git a/test/controllers/admin_controller_test.rb b/test/controllers/admin_controller_test.rb
new file mode 100644
index 0000000..7bb9eb9
--- /dev/null
+++ b/test/controllers/admin_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AdminControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/helpers/admin_helper_test.rb b/test/helpers/admin_helper_test.rb
new file mode 100644
index 0000000..23d9f40
--- /dev/null
+++ b/test/helpers/admin_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AdminHelperTest < ActionView::TestCase
+end