From 341097c5ca907e4934cccadc198bcc50b3e17e7f Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Mon, 19 May 2014 19:51:18 -0700 Subject: [PATCH] A couple improvements for the LadderSubmissionView. --- app/locale/en.coffee | 1 + app/styles/play/common/ladder_submission.sass | 12 +++++++++++- app/templates/play/common/ladder_submission.jade | 9 +++++++-- app/views/play/common/ladder_submission_view.coffee | 3 +++ app/views/play/ladder/my_matches_tab.coffee | 1 - 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index c5e79f30d..8663fe60b 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -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 " diff --git a/app/styles/play/common/ladder_submission.sass b/app/styles/play/common/ladder_submission.sass index 467175533..4de48fcee 100644 --- a/app/styles/play/common/ladder_submission.sass +++ b/app/styles/play/common/ladder_submission.sass @@ -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 + diff --git a/app/templates/play/common/ladder_submission.jade b/app/templates/play/common/ladder_submission.jade index 5ff0e82cb..ca674d846 100644 --- a/app/templates/play/common/ladder_submission.jade +++ b/app/templates/play/common/ladder_submission.jade @@ -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 -a(href=simulateURL, data-i18n="ladder.help_simulate").help-simulate.secret Help simulate games? \ No newline at end of file +if lastSubmitted + .last-submitted.secret submitted #{lastSubmitted} + +a(href=simulateURL, data-i18n="ladder.help_simulate").help-simulate.secret Help simulate games? + +.clearfix \ No newline at end of file diff --git a/app/views/play/common/ladder_submission_view.coffee b/app/views/play/common/ladder_submission_view.coffee index 67f0ee97d..9a0052647 100644 --- a/app/views/play/common/ladder_submission_view.coffee +++ b/app/views/play/common/ladder_submission_view.coffee @@ -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() diff --git a/app/views/play/ladder/my_matches_tab.coffee b/app/views/play/ladder/my_matches_tab.coffee index 4c76354ac..916ae3dfa 100644 --- a/app/views/play/ladder/my_matches_tab.coffee +++ b/app/views/play/ladder/my_matches_tab.coffee @@ -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)