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

Fixed Layouts

This commit is contained in:
Jacob Cody Wimer
2014-01-03 11:03:08 -05:00
parent 62a7cdabbc
commit e27c29d313
15 changed files with 88 additions and 33 deletions

View File

@@ -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/

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
class AdminController < ApplicationController
def index
end
end

View File

@@ -10,6 +10,7 @@ class SchoolsController < ApplicationController
# GET /schools/1 # GET /schools/1
# GET /schools/1.json # GET /schools/1.json
def show def show
@wrestlers = Wrestler.all
end end
# GET /schools/new # GET /schools/new

View File

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

View File

@@ -0,0 +1,6 @@
<%= link_to "Go to Schools", '/schools/' %>
<br>
<%= link_to "Go to Weights", '/weights/' %>
<br>
<%= link_to "Go to Wrestlers", '/wrestlers/' %>
<br>

View File

@@ -8,6 +8,10 @@
<li><%= link_to "School Scores", '/static_pages/school' %></li> <li><%= link_to "School Scores", '/static_pages/school' %></li>
<li><%= link_to "Brackets" , '#' %></li> <li><%= link_to "Brackets" , '#' %></li>
<li><%= link_to "Bout Board" , '#' %></li> <li><%= link_to "Bout Board" , '#' %></li>
<% #If logged in %>
<li><%= link_to "Admin" , '/admin/index' %></li>
<% #ELSE %>
<li><%= link_to "Log In" , '#' %></li>
</ul> </ul>
</nav> </nav>
</div> </div>

View File

@@ -1,13 +1,11 @@
<h1>Listing schools</h1> <h1>Listing schools</h1>
<table> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Score</th> <th>Score</th>
<th></th> <th>Actions</th>
<th></th>
<th></th>
</tr> </tr>
</thead> </thead>
@@ -16,9 +14,7 @@
<tr> <tr>
<td><%= school.name %></td> <td><%= school.name %></td>
<td><%= school.score %></td> <td><%= school.score %></td>
<td><%= link_to 'Show', school %></td> <td><%= 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" %></td>
<td><%= link_to 'Edit', edit_school_path(school) %></td>
<td><%= link_to 'Destroy', school, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -10,5 +10,37 @@
<%= @school.score %> <%= @school.score %>
</p> </p>
<%= link_to 'Edit', edit_school_path(@school) %> | <%= link_to "Edit #{@school.name}", edit_school_path(@school) %> |
<%= link_to 'Back', schools_path %> <%= link_to 'Back to Schools', schools_path %> |
<%= link_to 'Back to Admin', '/admin/index' %>
<br>
<br>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Weight</th>
<th>Seed</th>
<th>Original seed</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @wrestlers.each do |wrestler| %>
<% if wrestler.school_id == @school.id %>
<tr>
<td><%= wrestler.name %></td>
<td><%= Weight.find(wrestler.weight_id).max %></td>
<td><%= wrestler.seed %></td>
<td><%= wrestler.original_seed %></td>
<td><%= 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" %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@@ -1,12 +1,10 @@
<h1>Listing weights</h1> <h1>Listing weights</h1>
<table> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th>Max</th> <th>Max</th>
<th></th> <th>Actions</th>
<th></th>
<th></th>
</tr> </tr>
</thead> </thead>
@@ -14,9 +12,7 @@
<% @weights.each do |weight| %> <% @weights.each do |weight| %>
<tr> <tr>
<td><%= weight.max %></td> <td><%= weight.max %></td>
<td><%= link_to 'Show', weight %></td> <td><%= 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" %></td>
<td><%= link_to 'Edit', edit_weight_path(weight) %></td>
<td><%= link_to 'Destroy', weight, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -3,8 +3,9 @@
<h1>Weight Class:<%= @weight.max %></h1> <h1>Weight Class:<%= @weight.max %></h1>
<%= link_to 'Edit Weight Class', edit_weight_path(@weight) %> | <%= link_to "Edit #{@weight.max} Weight Class", edit_weight_path(@weight) %> |
<%= link_to 'Back to Weight Classes', weights_path %> <%= link_to 'Back to Weight Classes', weights_path %> |
<%= link_to 'Back to Admin', '/admin/index' %>
<br> <br>
<br> <br>
<br> <br>

View File

@@ -1,31 +1,25 @@
<h1>Listing wrestlers</h1> <h1>Listing wrestlers</h1>
<table> <table class="table table-striped table-bordered">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>School</th>
<th>Weight</th> <th>Weight</th>
<th>Seed</th> <th>Seed</th>
<th>Original seed</th> <th>Original seed</th>
<th></th> <th>Actions</th>
<th></th>
<th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @wrestlers.each do |wrestler| %> <% @wrestlers.each do |wrestler| %>
<tr> <tr>
<td><%= wrestler.name %></td> <td><%= wrestler.name %></td>
<td><%= School.find(wrestler.school_id).name %></td> <td><%= Weight.find(wrestler.weight_id).max %></td>
<td><%= Weight.find(wrestler.weight_id).max %></td> <td><%= wrestler.seed %></td>
<td><%= wrestler.seed %></td> <td><%= wrestler.original_seed %></td>
<td><%= wrestler.original_seed %></td> <td><%= 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" %></td>
<td><%= link_to 'Show', wrestler %></td> </tr>
<td><%= link_to 'Edit', edit_wrestler_path(wrestler) %></td>
<td><%= link_to 'Destroy', wrestler, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>

View File

@@ -11,6 +11,7 @@ Wrestling::Application.routes.draw do
# You can have the root of your site routed with "root" # You can have the root of your site routed with "root"
root 'static_pages#index' root 'static_pages#index'
get 'static_pages/school' get 'static_pages/school'
get 'admin/index'
# Example of regular route: # Example of regular route:
# get 'products/:id' => 'catalog#view' # get 'products/:id' => 'catalog#view'

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class AdminControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@@ -0,0 +1,4 @@
require 'test_helper'
class AdminHelperTest < ActionView::TestCase
end