Skip to content

Commit

Permalink
#126 tables formatted a bit better
Browse files Browse the repository at this point in the history
also after a reload, tables are no longer marked as sorted
  • Loading branch information
ebshimizu committed Mar 30, 2018
1 parent 3e42e9b commit 85d2d52
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 13 deletions.
2 changes: 2 additions & 0 deletions js/hero-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ function loadOverallHeroCollectionData() {

$('#hero-collection-pool table').floatThead('reflow');
$('#hero-collection-comps table').floatThead('reflow');
$('#hero-collection-page-content th').removeClass('sorted ascending descending');
})
}

Expand Down Expand Up @@ -385,6 +386,7 @@ function loadHeroCollectionData(value, text, $elem) {
$('#hero-collection-detail-misc-summary .statistic[name="overallAward"] .value').text(formatStat('pct', stats.totalAward / Math.max(stats.games)));

$('#hero-collection-page-content table').floatThead('reflow');
$('#hero-collection-page-content th').removeClass('sorted ascending descending');
});
}

Expand Down
1 change: 1 addition & 0 deletions js/hero-trends.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ function loadTrends() {
}

$('#hero-trends-body table').floatThead('reflow');
$('#hero-trends-body th').removeClass('sorted ascending descending');
});
});

Expand Down
1 change: 1 addition & 0 deletions js/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@ function loadMapStats() {
});

$('#maps-page-content table').floatThead('reflow');
$('#maps-page-content th').removeClass('sorted ascending descending');
});
}
1 change: 1 addition & 0 deletions js/match-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ function loadMatch(docs, doneLoadCallback) {
$('#match-detail-details').scrollTop(0);
doneLoadCallback();
$('#match-detail-details table').floatThead('reflow');
$('#match-detail-body th').removeClass('sorted ascending descending');
}

function updateBasicInfo() {
Expand Down
2 changes: 2 additions & 0 deletions js/player-ranking.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,7 @@ function loadPlayerRankings() {
$('#player-ranking-body .player-name').click(function() {
showPlayerProfile($(this).attr('playerID'));
});

$('#player-ranking-body th').removeClass('sorted ascending descending');
});
}
5 changes: 5 additions & 0 deletions js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ function processPlayerData(err, docs) {

let val = $('#player-compare-collection').dropdown('get value');
updatePlayerCollectionCompare(val, null, $('#player-compare-collection .menu .item[data-value="' + val + '"]'));
$('#player-detail-body th').removeClass('sorted ascending descending');
}

// callback for hero select menu
Expand Down Expand Up @@ -567,6 +568,7 @@ function showHeroDetails(value, text, $selectedItem) {
updateHeroTitle($('#player-detail-summary-header'), value);
let val = $('#player-compare-collection').dropdown('get value');
updatePlayerCollectionCompare(val, null, $('#player-compare-collection .menu .item[data-value="' + val + '"]'));
$('#player-detail-body th').removeClass('sorted ascending descending');
}

function updateHeroTitle(container, value) {
Expand Down Expand Up @@ -831,6 +833,9 @@ function renderMapStatsTo(container, stats) {

container.find('tbody').append(playerDetailMapSummaryRowTemplate(context));
}

// clear sort from headers
container.find('th').removeClass('sorted ascending descending');
}

// expects stats to be from DB.summarizeHeroData(docs).withHero / againstHero
Expand Down
1 change: 1 addition & 0 deletions js/team-ranking.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,5 @@ function updateTeamRankingData(err, matches, team) {
$('#team-ranking-match-table tbody').append(teamRankingMatchTemplate(teamStats));
$('#team-ranking-cc-table tbody').append(teamRankingCCTemplate(teamStats));
$('#team-ranking-structure-table tbody').append(teamRankingStructureTemplate(teamStats));
$('#team-ranking-body th').removeClass('sorted ascending descending');
}
4 changes: 4 additions & 0 deletions js/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ function loadTeamData(team, matches, heroData) {
updateTeamCollectionCompare($('#team-compare-collection').dropdown('get value'), null, null);

$('#team-detail-body table').floatThead('reflow');
$('#team-detail-body th').removeClass('sorted ascending descending');
}

function toggleTeamRosterMode(elem) {
Expand All @@ -463,6 +464,9 @@ function loadTeamRoster(playerStats) {
$('#team-roster-stats tbody').html('');
let mode = $('#team-roster-stats .top.attached.menu .active.item').attr('data-mode');

if (currentTeam === undefined)
return;

for (let p in currentTeam.players) {
let id = currentTeam.players[p];

Expand Down
22 changes: 11 additions & 11 deletions templates/player-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ <h3 class="ui inverted dividing header">Games Won by Role</h3>
<table class="ui sortable selectable inverted table">
<thead>
<tr>
<th>Map</th>
<th>Win %</th>
<th>Games</th>
<th class="center aligned">Map</th>
<th class="center aligned stat">Win %</th>
<th class="center aligned stat">Games</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -344,9 +344,9 @@ <h3 class="ui inverted dividing header">Games Won by Role</h3>
<table class="ui sortable selectable compact inverted table">
<thead>
<tr>
<th>Hero</th>
<th>Win %</th>
<th>Games</th>
<th class="center aligned">Hero</th>
<th class="center aligned stat">Win %</th>
<th class="center aligned stat">Games</th>
</tr>
</thead>
<tbody>
Expand All @@ -363,9 +363,9 @@ <h3 class="ui inverted dividing header">Games Won by Role</h3>
<table class="ui sortable selectable compact inverted table">
<thead>
<tr>
<th>Hero</th>
<th>Win %</th>
<th>Games</th>
<th class="center aligned">Hero</th>
<th class="center aligned stat">Win %</th>
<th class="center aligned stat">Games</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -550,8 +550,8 @@ <h3 class="ui inverted dividing header">Games Won by Role</h3>
<thead>
<tr>
<th>Award</th>
<th>Award %</th>
<th>Games</th>
<th class="center aligned stat">Award %</th>
<th class="center aligned stat">Games</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions templates/teams-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ <h1 class="ui inverted header team-name">[Team Name]</h1>
<thead>
<tr>
<th>Hero</th>
<th>Win %</th>
<th>Games</th>
<th class="center aligned stat">Win %</th>
<th class="center aligned stat">Games</th>
</tr>
</thead>
<tbody>
Expand Down

0 comments on commit 85d2d52

Please sign in to comment.