Created
July 5, 2012 15:17
-
-
Save dwradcliffe/3054312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player < ActiveRecord::Base | |
def salary_valid_for_year? year | |
send("s#{year}") != 0 && send("status#{year}") != 0 && !send("status#{year}").nil? | |
end | |
def salary_for_year year | |
send("s#{year}") | |
end | |
def salary_notes_for_year year | |
send("status#{year}").notes | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= link_to 'Back', players_path %> | |
<% content_for :sidebar do %> | |
<ul> | |
<li><% @title %></li> | |
</ul> | |
<% end %> | |
<br> | |
<p><h3> | |
<%= "#{@player.first_name} #{@player.last_name}" %> | <%= @player.namenick %> | <%= "#{@player.birthcity}, #{@player.birthstate}" %> | <%= @player.team.name unless @team.nil? %></h3> | |
</p> | |
<p> | |
Bats: <%= @player.bats%> | |
Throws: <%= @player.throws%><br> | |
Weight: <%= @player.weight%> lbs | |
Height: <%= @player.height%> inches<br> | |
Debut: <%= @player.debut%><br> | |
Birthday: <%= @player.birthmonth%>/<%= @player.birthday%>/<%= @player.birthyear%><br> | |
Facebook: <%= @player.facebook%><br> | |
Twitter: <%= @player.twitter%><br> | |
Agent: <%= link_to @player.agent.name, agents_path(@agent) unless @agent.nil? %><br> | |
</p> | |
<table id="myTable" class="tablesorter"> | |
<thead> | |
<tr> | |
<th>Year</th> | |
<th>Salary</th> | |
<th>Salary Notes</th> | |
</tr> | |
</thead> | |
<tbody> | |
<% (1985..2024).each do |year| %> | |
<tr> | |
<% if @player.salary_valid_for_year?(year) %> | |
<td><%= year %></td> | |
<td>$<%= number_with_delimiter(@player.salary_for_year(year), :delimiter => ',') %></td> | |
<td><%= @player.salary_notes_for_year(year) %></td> | |
<% end %> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
<script> $(document).ready(function() | |
{ | |
$("table").tablesorter(); | |
} | |
); </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment