From 8e5e1d60a3e4a255ac7d17086c1e68debd7c579d Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 22 Jan 2014 10:06:38 -0500 Subject: [PATCH] Fixed school view --- app/controllers/schools_controller.rb | 1 + app/views/schools/show.html.erb | 22 +++++++++++++++------- app/views/wrestlers/_form.html.erb | 4 ---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index 59cce07..dda3848 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -11,6 +11,7 @@ class SchoolsController < ApplicationController # GET /schools/1.json def show @wrestlers = Wrestler.all + @tournament = Tournament.find(@school.tournament_id) end # GET /schools/new diff --git a/app/views/schools/show.html.erb b/app/views/schools/show.html.erb index fb7d727..fb16a5c 100644 --- a/app/views/schools/show.html.erb +++ b/app/views/schools/show.html.erb @@ -15,15 +15,19 @@ <%= 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' %> +<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %> | +<% if user_signed_in? %> + <%= link_to "Edit #{@school.name}", edit_school_path(@school) %> | + <%= link_to 'Back to Admin', '/admin/index' %> +<% end %>

-<%= link_to "New #{@school.name} Wrestler" , "/wrestlers/new?school=#{@school.id}" %> +<% if user_signed_in? %> + <%= link_to "New #{@school.name} Wrestler" , "/wrestlers/new?school=#{@school.id}" %> +<% end %>

@@ -33,7 +37,6 @@ Name Weight Seed - Original seed Actions @@ -44,9 +47,14 @@ <%= 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" %> + + <% if user_signed_in? %> + <%= 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 %> <% end %> diff --git a/app/views/wrestlers/_form.html.erb b/app/views/wrestlers/_form.html.erb index d748843..84a0d1c 100644 --- a/app/views/wrestlers/_form.html.erb +++ b/app/views/wrestlers/_form.html.erb @@ -29,10 +29,6 @@ <%= f.label 'Weight Class' %>
<%= f.collection_select :weight_id, Weight.all, :id, :max %> -
- <%= f.label :seed %>
- <%= f.number_field :seed %> -
<%= f.label :original_seed %>
<%= f.number_field :original_seed %>