Skip to content

Commit

Permalink
show tournament player rank
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 22, 2015
1 parent 5f0e9e2 commit bcf30e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 5 additions & 2 deletions public/stylesheets/tournament.css
Expand Up @@ -87,8 +87,8 @@ ol.scheduled_tournaments a:hover {
background: url(../images/icons/trophy-2.min.svg) no-repeat;
}
#tournament .podium .third .trophy {
height: 60px;
width: calc(1.1056 * 60px);
height: 65px;
width: calc(1.1056 * 65px);
background: url(../images/icons/trophy-3.min.svg) no-repeat;
}
#tournament .podium .trophy {
Expand Down Expand Up @@ -189,6 +189,9 @@ ol.scheduled_tournaments a:hover {
width: 525px;
border-bottom: none;
}
#tournament table.standing .player_rank {
margin-left: 10px;
}
#tournament table.standing td:first-child,
#tournament table.standing th:first-child {
padding-left: 10px;
Expand Down
7 changes: 6 additions & 1 deletion ui/tournament/src/view/arena.js
Expand Up @@ -133,11 +133,16 @@ module.exports = {
var maxScore = Math.max.apply(Math, ctrl.data.players.map(function(p) {
return p.sheet.total;
}));
var player = util.currentPlayer(ctrl);
return [
m('thead',
m('tr', [
m('th.large', [
ctrl.trans('standing') + ' (' + ctrl.data.players.length + ')'
ctrl.trans('standing'),
player ? [
m('strong.player_rank', player.rank),
' / ' + ctrl.data.players.length
] : ' (' + ctrl.data.players.length + ')'
]),
m('th.legend[colspan=2]', [
m('streakstarter', 'Streak starter'),
Expand Down
6 changes: 6 additions & 0 deletions ui/tournament/src/view/util.js
Expand Up @@ -52,6 +52,12 @@ module.exports = {
] : null
]);
},
currentPlayer: function(ctrl) {
if (!ctrl.userId) return null;
return ctrl.data.players.filter(function(p) {
return p.id === ctrl.userId;
})[0] || null;
},
player: function(p) {
var perf;
if (p.perf > 0) perf = m('span.positive[data-icon=N]', p.perf);
Expand Down

0 comments on commit bcf30e7

Please sign in to comment.