A couple improvements for the LadderSubmissionView.

This commit is contained in:
Nick Winter 2014-05-19 19:51:18 -07:00
parent d8df61f94b
commit 341097c5ca
5 changed files with 22 additions and 4 deletions

View file

@ -660,6 +660,7 @@
rank_submitted: "Submitted for Ranking"
rank_failed: "Failed to Rank"
rank_being_ranked: "Game Being Ranked"
rank_last_submitted: "submitted "
help_simulate: "Help simulate games?"
code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in."
no_ranked_matches_pre: "No ranked matches for the "

View file

@ -1,4 +1,14 @@
.ladder-submission-view
.help-simulate
button
text-shadow: 0px -1px 0px black
.last-submitted, .help-simulate
font-size: 14px
font-weight: normal
.last-submitted
float: left
.help-simulate
float: right

View file

@ -1,4 +1,4 @@
button.btn.btn-lg.btn-success.rank-button
button.btn.btn-lg.btn-block.btn-success.rank-button
span(data-i18n="ladder.rank_no_code").unavailable.secret No New Code to Rank
span(data-i18n="ladder.rank_my_game").rank.secret Rank My Game!
span(data-i18n="ladder.rank_submitting").submitting.secret Submitting...
@ -6,4 +6,9 @@ button.btn.btn-lg.btn-success.rank-button
span(data-i18n="ladder.rank_failed").failed.secret Failed to Rank
span(data-i18n="ladder.rank_being_ranked").ranking.secret Game Being Ranked
if lastSubmitted
.last-submitted.secret submitted #{lastSubmitted}
a(href=simulateURL, data-i18n="ladder.help_simulate").help-simulate.secret Help simulate games?
.clearfix

View file

@ -19,6 +19,7 @@ module.exports = class LadderSubmissionView extends CocoView
ctx.readyToRank = @session?.readyToRank()
ctx.isRanking = @session?.get('isRanking')
ctx.simulateURL = "/play/ladder/#{@level.get('slug')}#simulate"
ctx.lastSubmitted = moment(submitDate).fromNow() if submitDate = @session?.get('submitDate')
ctx
afterRender: ->
@ -41,6 +42,8 @@ module.exports = class LadderSubmissionView extends CocoView
@rankButton.toggleClass 'disabled', spanClass isnt 'rank'
helpSimulate = spanClass in ['submitted', 'ranking']
@$el.find('.help-simulate').toggle(helpSimulate, 'slow')
showLastSubmitted = not (spanClass in ['submitting'])
@$el.find('.last-submitted').toggle(showLastSubmitted)
rankSession: (e) ->
return unless @session.readyToRank()

View file

@ -100,7 +100,6 @@ module.exports = class MyMatchesTabView extends CocoView
session = _.find @sessions.models, {id: sessionID}
ladderSubmissionView = new LadderSubmissionView session: session, level: @level
@insertSubView ladderSubmissionView, placeholder
ladderSubmissionView.$el.find('.rank-button').addClass 'btn-block'
@$el.find('.score-chart-wrapper').each (i, el) =>
scoreWrapper = $(el)