Skip to content

Commit

Permalink
Merge pull request smogon#400 from sirDonovan/tournaments
Browse files Browse the repository at this point in the history
Tournaments: add cancel button
  • Loading branch information
Zarel committed Jun 8, 2015
2 parents 5c40d42 + e408ae7 commit 1667107
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions js/client-chat-tournament.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
'<button class="button tournament-challenge-challenge">Challenge</button>' +
'</div>' +
'<div class="tournament-challengeby"></div>' +
'<div class="tournament-challenging"></div>' +
'<div class="tournament-challenging">' +
'<div class="tournament-challenging-message"></div>' +
'<button class="button tournament-challenge-cancel">Cancel</button>' +
'</div>' +
'<div class="tournament-challenged">' +
'<div class="tournament-challenged-message"></div>' +
'<span class="tournament-team"></span>' +
Expand All @@ -130,9 +133,11 @@
this.$challengeChallenge = $wrapper.find('.tournament-challenge-challenge');
this.$challengeBy = $wrapper.find('.tournament-challengeby');
this.$challenging = $wrapper.find('.tournament-challenging');
this.$challengingMessage = $wrapper.find('.tournament-challenging-message');
this.$challenged = $wrapper.find('.tournament-challenged');
this.$challengedMessage = $wrapper.find('.tournament-challenged-message');
this.$challengeAccept = $wrapper.find('.tournament-challenge-accept');
this.$challengeCancel = $wrapper.find('.tournament-challenge-cancel');

this.info = {};
this.updates = {};
Expand Down Expand Up @@ -172,6 +177,9 @@
self.room.send('/utm ' + Storage.packTeam(team ? team.team : null));
self.room.send('/tournament acceptchallenge');
});
this.$challengeCancel.on('click', function() {
self.room.send('/tournament cancelchallenge');
});

app.user.on('saveteams', this.updateTeams, this);
}
Expand Down Expand Up @@ -372,8 +380,7 @@
if ('challenging' in this.updates) {
this.$challenging.toggleClass('active', !!this.info.challenging);
if (this.info.challenging) {
this.$challenging.text("Challenging " + this.info.challenging + "...");
// TODO: Add cancel button
this.$challengingMessage.text("Challenging " + this.info.challenging + "...");
}
}

Expand Down

0 comments on commit 1667107

Please sign in to comment.