Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Fixed tablesorter issues, fixes #24
Browse files Browse the repository at this point in the history
  • Loading branch information
Procrat committed Mar 21, 2015
1 parent 5e04fd7 commit 5f9d10c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 1,047 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ group :dev do
gem 'annotate'
end

# Use datenfisch
# Use datenfisch (https://github.com/Iasoon/datenfisch.git)
gem 'datenfisch', git: 'git://github.com/Iasoon/datenfisch.git',
ref: 'e4ab1d5e65ae4bded93dd19296bf13167adbb91e'

# Use jQuery plugin tablesorter (https://github.com/Mottie/tablesorter)
gem 'jquery-tablesorter'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ GEM
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-tablesorter (1.16.2)
railties (>= 3.2, < 5)
jquery-turbolinks (2.1.0)
railties (>= 3.1.0)
turbolinks
Expand Down Expand Up @@ -270,6 +272,7 @@ DEPENDENCIES
github_api
jbuilder (~> 1.2)
jquery-rails
jquery-tablesorter
jquery-turbolinks
mysql2
omniauth
Expand Down
20 changes: 18 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,24 @@
//= require turbolinks

//= require bootstrap-sprockets
//= require tablesorter/jquery.tablesorter
//= require tablesorter/tables.js
//= require jquery-tablesorter

//= require_self
//= require_tree .


$(document).ready(function() {
$.tablesorter.addParser({
id: "digit",
is: function (s, table) {
var c = table.config;
return $.tablesorter.isDigit(s, c);
},
format: function (s) {
return $.tablesorter.formatFloat(s.replace(/\s+/g, ''));
},
type: "numeric",
});

$('table.tablesorter').tablesorter();
});
2 changes: 2 additions & 0 deletions app/assets/javascripts/scoreboard.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
{ filters: filters }
).success (rows) ->
$('#scoreboard tbody').html(rows)
resort = true
$('#scoreboard').trigger('update', [resort]);
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
*= require_self
*= require_tree .
*= require jquery-tablesorter/theme.bootstrap
*/
@import "bootstrap-sprockets";
@import "bootstrap";
Expand Down
4 changes: 2 additions & 2 deletions app/views/bounties/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<tr>
<th>Repo</th>
<th>Issue</th>
<th>Total bounty</th>
<th>My bounty</th>
<th data-sort-initial-order="desc">Total bounty</th>
<th data-sort-initial-order="desc">My bounty</th>
</tr>
</thead>

Expand Down
Empty file.
16 changes: 8 additions & 8 deletions app/views/scoreboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
<h1>Scoreboard</h1>
</div>
<div class="table-responsive">
<table id="scoreboard" class="table table-striped">
<table id="scoreboard" class="table table-striped tablesorter">
<thead>
<tr>
<tr>
<th></th>
<th></th>
<th>Contributor</th>
<th class="score">Score</th>
<th class="commits">Commits</th>
<th class="additions">Additions</th>
<th class="deletions">Deletions</th>
</tr>
<th class="score" data-sort-initial-order="desc">Score</th>
<th class="commits" data-sort-initial-order="desc">Commits</th>
<th class="additions" data-sort-initial-order="desc">Additions</th>
<th class="deletions" data-sort-initial-order="desc">Deletions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<%= render partial: 'scoreboard' %>
</div>
<div class="col-md-2"></div>
</div>
<%= javascript_tag "get_scoreboard('#{scoreboard_path}', {});" %>

0 comments on commit 5f9d10c

Please sign in to comment.