1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-05 06:07:20 +00:00

Added dataTables for matches and tournaments.

This commit is contained in:
2015-02-11 10:50:25 -05:00
parent f32b91def7
commit bdec6c0463
11 changed files with 28804 additions and 8 deletions

View File

@@ -12,6 +12,6 @@
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap
//= require dataTables/jquery.dataTables

View File

@@ -1,3 +1,6 @@
# 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/
jQuery ->
$('#matches').dataTable()
dJQueryUI: true

View File

@@ -1,3 +1,6 @@
# 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/
jQuery ->
$('#tournaments').dataTable()
dJQueryUI: true

View File

@@ -12,4 +12,5 @@
*
*= require_tree .
*= require_self
*= require dataTables/jquery.dataTables
*/

View File

@@ -1,11 +1,21 @@
class Match < ActiveRecord::Base
belongs_to :tournament
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
attr_accessor :weight_max
attr_accessor :weight_max, :w1_name, :w1_name
def weight_max
@guy = Wrestler.find(self.r_id)
@weight = Weight.find(@guy.weight_id)
return @weight.max
end
def w1_name
return Wrestler.find(self.r_id).name
end
def w2_name
return Wrestler.find(self.g_id).name
end
end

View File

@@ -4,7 +4,7 @@
<% end %>
</br>
</br>
<table class="table table-striped table-bordered">
<table class="display compact cell-border" id="tournaments">
<thead>
<tr>
<th>Name</th>

View File

@@ -2,7 +2,28 @@
<br>
<br>
<h3>Upcoming Matches</h3>
<% @matches.each do |m| %>
Round <%= m.round %> Bout <%= m.boutNumber %> <%= Wrestler.find(m.r_id).weight.max %> Lbs <%= Wrestler.find(m.r_id).name %> vs. <%= Wrestler.find(m.g_id).weight.max %> Lbs <%= Wrestler.find(m.g_id).name %>
<br>
<% end %>
<br>
<br>
<table class="display compact cell-border" id="matches">
<thead>
<tr>
<th>Round</th>
<th>Bout Number</th>
<th>Weight Class</th>
<th>Matchup</th>
</tr>
</thead>
<tbody>
<% @matches.each do |m| %>
<tr>
<td>Round <%= m.round %></td>
<td>Bout <%= m.boutNumber %></td>
<td><%= m.weight_max %> lbs</td>
<td><%= m.w1_name %> vs. <%= m.w2_name %></td>
</tr>
<% end %>
</tbody>
</table>
<br>