mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added dataTables for matches and tournaments.
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -53,6 +53,8 @@ gem 'spring', group: :development
|
|||||||
gem 'round_robin_tournament'
|
gem 'round_robin_tournament'
|
||||||
gem 'rb-readline'
|
gem 'rb-readline'
|
||||||
gem 'delayed_job_active_record'
|
gem 'delayed_job_active_record'
|
||||||
|
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
|
||||||
|
gem 'jquery-ui-rails'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
20
Gemfile.lock
20
Gemfile.lock
@@ -1,3 +1,13 @@
|
|||||||
|
GIT
|
||||||
|
remote: git://github.com/rweng/jquery-datatables-rails.git
|
||||||
|
revision: db17aa0145164095b2b21f83f1ef7ccf91b9ea54
|
||||||
|
specs:
|
||||||
|
jquery-datatables-rails (3.1.1)
|
||||||
|
actionpack (>= 3.1)
|
||||||
|
jquery-rails
|
||||||
|
railties (>= 3.1)
|
||||||
|
sass-rails
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@@ -74,6 +84,11 @@ GEM
|
|||||||
rails-dom-testing (~> 1.0)
|
rails-dom-testing (~> 1.0)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
jquery-turbolinks (2.1.0)
|
||||||
|
railties (>= 3.1.0)
|
||||||
|
turbolinks
|
||||||
|
jquery-ui-rails (5.0.3)
|
||||||
|
railties (>= 3.2.16)
|
||||||
json (1.8.2)
|
json (1.8.2)
|
||||||
loofah (2.0.1)
|
loofah (2.0.1)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
@@ -135,7 +150,7 @@ GEM
|
|||||||
sdoc (0.4.1)
|
sdoc (0.4.1)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
rdoc (~> 4.0)
|
rdoc (~> 4.0)
|
||||||
spring (1.3.0)
|
spring (1.3.1)
|
||||||
sprockets (2.12.3)
|
sprockets (2.12.3)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
@@ -169,7 +184,10 @@ DEPENDENCIES
|
|||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
devise
|
devise
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
|
jquery-datatables-rails!
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
jquery-turbolinks
|
||||||
|
jquery-ui-rails
|
||||||
mysql2
|
mysql2
|
||||||
pg
|
pg
|
||||||
rails (= 4.2.0)
|
rails (= 4.2.0)
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require turbolinks
|
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
//= require bootstrap
|
//= require bootstrap
|
||||||
|
//= require dataTables/jquery.dataTables
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
# Place all the behaviors and hooks related to the matching controller here.
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
# All this logic will automatically be available in application.js.
|
# All this logic will automatically be available in application.js.
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
|
jQuery ->
|
||||||
|
$('#matches').dataTable()
|
||||||
|
dJQueryUI: true
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
# Place all the behaviors and hooks related to the matching controller here.
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
# All this logic will automatically be available in application.js.
|
# All this logic will automatically be available in application.js.
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
|
jQuery ->
|
||||||
|
$('#tournaments').dataTable()
|
||||||
|
dJQueryUI: true
|
||||||
@@ -12,4 +12,5 @@
|
|||||||
*
|
*
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
*= require_self
|
*= require_self
|
||||||
|
*= require dataTables/jquery.dataTables
|
||||||
*/
|
*/
|
||||||
@@ -1,11 +1,21 @@
|
|||||||
class Match < ActiveRecord::Base
|
class Match < ActiveRecord::Base
|
||||||
belongs_to :tournament
|
belongs_to :tournament
|
||||||
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
|
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
|
def weight_max
|
||||||
@guy = Wrestler.find(self.r_id)
|
@guy = Wrestler.find(self.r_id)
|
||||||
@weight = Weight.find(@guy.weight_id)
|
@weight = Weight.find(@guy.weight_id)
|
||||||
return @weight.max
|
return @weight.max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def w1_name
|
||||||
|
return Wrestler.find(self.r_id).name
|
||||||
|
end
|
||||||
|
|
||||||
|
def w2_name
|
||||||
|
return Wrestler.find(self.g_id).name
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</br>
|
</br>
|
||||||
</br>
|
</br>
|
||||||
<table class="table table-striped table-bordered">
|
<table class="display compact cell-border" id="tournaments">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|||||||
@@ -2,7 +2,28 @@
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<h3>Upcoming Matches</h3>
|
<h3>Upcoming Matches</h3>
|
||||||
<% @matches.each do |m| %>
|
<br>
|
||||||
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>
|
||||||
<br>
|
<table class="display compact cell-border" id="matches">
|
||||||
<% end %>
|
<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>
|
||||||
|
|||||||
28738
public/assets/application-24c586634efef58bd0862cc70a5c6407.js
Normal file
28738
public/assets/application-24c586634efef58bd0862cc70a5c6407.js
Normal file
File diff suppressed because it is too large
Load Diff
BIN
public/assets/application-24c586634efef58bd0862cc70a5c6407.js.gz
Normal file
BIN
public/assets/application-24c586634efef58bd0862cc70a5c6407.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user