From 1e8977548629108e40cad7ffa1493ae2511b1fed Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 15 Jul 2016 09:53:08 -0700 Subject: [PATCH] Basic campaign mode victory modal hookup for web-dev levels --- app/locale/en.coffee | 3 +++ app/models/LevelSession.coffee | 1 + app/schemas/schemas.coffee | 3 +++ app/styles/play/level/loading.sass | 7 +++++++ app/templates/courses/course-details.jade | 2 +- app/templates/editor/level/edit.jade | 2 +- app/templates/play/ladder/play_modal.jade | 2 +- app/templates/play/level/modal/hero-victory-modal.jade | 4 ++-- app/templates/play/level/modal/victory.jade | 2 +- app/views/play/level/PlayLevelView.coffee | 2 +- app/views/play/level/modal/HeroVictoryModal.coffee | 2 +- app/views/play/level/tome/CastButtonView.coffee | 6 +++--- 12 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 416dfead9..c5c2138b7 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -1877,6 +1877,9 @@ vectors: "Vectors" while_loops: "While Loops" recursion: "Recursion" + basic_html: "Basic HTML" # TODO: these web-dev concepts will change, don't need to translate + basic_css: "Basic CSS" + basic_web_scripting: "Basic Web Scripting" delta: added: "Added" diff --git a/app/models/LevelSession.coffee b/app/models/LevelSession.coffee index 23b68851c..71bb70bb4 100644 --- a/app/models/LevelSession.coffee +++ b/app/models/LevelSession.coffee @@ -74,6 +74,7 @@ module.exports = class LevelSession extends CocoModel wait recordScores: (scores, level) -> + return unless scores state = @get 'state' oldTopScores = state.topScores ? [] newTopScores = [] diff --git a/app/schemas/schemas.coffee b/app/schemas/schemas.coffee index f9be247c2..8dcd9bfb9 100644 --- a/app/schemas/schemas.coffee +++ b/app/schemas/schemas.coffee @@ -261,4 +261,7 @@ me.concept = me.shortString enum: [ 'vectors' 'while_loops' 'recursion' + 'basic_html' + 'basic_css' + 'basic_web_scripting' ] diff --git a/app/styles/play/level/loading.sass b/app/styles/play/level/loading.sass index d5d3f4537..ab692465f 100644 --- a/app/styles/play/level/loading.sass +++ b/app/styles/play/level/loading.sass @@ -74,6 +74,13 @@ $UNVEIL_TIME: 1.2s .progress-or-start-container.intro-footer bottom: 30px + @media screen and ( min-height: 900px ) + background: transparent + border: 1px solid transparent + border-width: 124px 76px 64px 40px + border-image: url(/images/level/code_editor_background.png) 124 76 64 40 fill round + padding: 0 35px 0 15px + .level-loading-goals text-align: left diff --git a/app/templates/courses/course-details.jade b/app/templates/courses/course-details.jade index 7b0ac0cf7..b15e25cc1 100644 --- a/app/templates/courses/course-details.jade +++ b/app/templates/courses/course-details.jade @@ -104,7 +104,7 @@ block content tr td if previousLevelCompleted || view.teacherMode || !passedLastCompletedLevel || levelStatus - - var i18n = level.get('type') === 'course-ladder' ? 'play.compete' : 'home.play'; + - var i18n = level.isType('course-ladder') ? 'play.compete' : 'home.play'; button.btn.btn-success.btn-play-level(data-level-slug=level.get('slug'), data-i18n=i18n, data-level-id=level.get('original')) if view.showGameDevButtons - var levelOriginal = level.get('original'); diff --git a/app/templates/editor/level/edit.jade b/app/templates/editor/level/edit.jade index 5496527d0..62a4b009d 100644 --- a/app/templates/editor/level/edit.jade +++ b/app/templates/editor/level/edit.jade @@ -64,7 +64,7 @@ block header a span.glyphicon-floppy-disk.glyphicon - if level.get('type') === 'ladder' + if level.isType('ladder') li.dropdown a(data-toggle='dropdown').play-with-team-parent span.glyphicon-play.glyphicon diff --git a/app/templates/play/ladder/play_modal.jade b/app/templates/play/ladder/play_modal.jade index 10118e10c..ecb48f01a 100644 --- a/app/templates/play/ladder/play_modal.jade +++ b/app/templates/play/ladder/play_modal.jade @@ -5,7 +5,7 @@ block modal-header-content block modal-body-content - if view.level.get('type') != 'course-ladder' + if !view.level.isType('course-ladder') h4.language-selection(data-i18n="ladder.select_your_language") Select your language! .form-group.select-group select#tome-language(name="language") diff --git a/app/templates/play/level/modal/hero-victory-modal.jade b/app/templates/play/level/modal/hero-victory-modal.jade index 540962ddd..345af217a 100644 --- a/app/templates/play/level/modal/hero-victory-modal.jade +++ b/app/templates/play/level/modal/hero-victory-modal.jade @@ -48,7 +48,7 @@ block modal-body-content textarea(data-i18n="[placeholder]play_level.victory_review_placeholder") .clearfix - if level.get('type', true) === 'hero' || level.get('type') == 'hero-ladder' + if level.isType('hero', 'hero-ladder', 'game-dev', 'web-dev') for achievement in achievements - var animate = achievement.completed && !achievement.completedAWhileAgo .achievement-panel(class=achievement.completedAWhileAgo ? 'earned' : '' data-achievement-id=achievement.id data-animate=animate) @@ -118,7 +118,7 @@ block modal-footer-content .next-level-buttons if readyToRank .ladder-submission-view - else if level.get('type') === 'hero-ladder' + else if level.isType('hero-ladder') button.btn.btn-illustrated.btn-primary.btn-lg.return-to-ladder-button(data-href="/play/ladder/#{level.get('slug')}#my-matches", data-dismiss="modal", data-i18n="play_level.victory_return_to_ladder") Return to Ladder else button.btn.btn-illustrated.btn-success.btn-lg.world-map-button.next-level-button.hide#continue-button(data-i18n="common.continue") Continue diff --git a/app/templates/play/level/modal/victory.jade b/app/templates/play/level/modal/victory.jade index effaad52c..6e6b9c56b 100644 --- a/app/templates/play/level/modal/victory.jade +++ b/app/templates/play/level/modal/victory.jade @@ -13,7 +13,7 @@ block modal-body-content block modal-footer-content if readyToRank .ladder-submission-view - else if level.get('type') === 'ladder' + else if level.isType('ladder') a.btn.btn-primary(href="/play/ladder/#{level.get('slug')}#my-matches", data-dismiss="modal", data-i18n="play_level.victory_return_to_ladder") Return to Ladder else a.btn.btn-primary(href="/", data-dismiss="modal", data-i18n="play_level.victory_go_home") Go Home diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index 05c0bdaa2..68e4bf4e3 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -376,7 +376,7 @@ module.exports = class PlayLevelView extends RootView @loadingView.startUnveiling() @loadingView.unveil true else - @scriptManager.initializeCamera() + @scriptManager?.initializeCamera() onLoadingViewUnveiling: (e) -> @selectHero() diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index 182a2ce4c..58ad2f6bb 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -379,7 +379,7 @@ module.exports = class HeroVictoryModal extends ModalView clearInterval @sequentialAnimationInterval @animationComplete = true @updateSavingProgressStatus() - Backbone.Mediator.publish 'music-player:enter-menu', terrain: @level.get('terrain', true) + Backbone.Mediator.publish 'music-player:enter-menu', terrain: @level.get('terrain', true) or 'forest' updateSavingProgressStatus: -> @$el.find('#saving-progress-label').toggleClass('hide', @readyToContinue) diff --git a/app/views/play/level/tome/CastButtonView.coffee b/app/views/play/level/tome/CastButtonView.coffee index 6a1e2b28e..f29520726 100644 --- a/app/views/play/level/tome/CastButtonView.coffee +++ b/app/views/play/level/tome/CastButtonView.coffee @@ -42,7 +42,7 @@ module.exports = class CastButtonView extends CocoView spell.view?.createOnCodeChangeHandlers() for spellKey, spell of @spells if @options.level.get('hidesSubmitUntilRun') or @options.level.get('hidesRealTimePlayback') or @options.level.isType('web-dev') @$el.find('.submit-button').hide() # Hide Submit for the first few until they run it once. - if @options.session.get('state')?.complete and @options.level.get 'hidesRealTimePlayback' + if @options.session.get('state')?.complete and (@options.level.get('hidesRealTimePlayback') or @options.level.isType('web-dev')) @$el.find('.done-button').show() if @options.level.get('slug') in ['course-thornbush-farm', 'thornbush-farm'] @$el.find('.submit-button').hide() # Hide submit until first win so that script can explain it. @@ -76,7 +76,7 @@ module.exports = class CastButtonView extends CocoView onDoneButtonClick: (e) -> return if @options.level.hasLocalChanges() # Don't award achievements when beating level changed in level editor - @options.session.recordScores @world.scores, @options.level + @options.session.recordScores @world?.scores, @options.level Backbone.Mediator.publish 'level:show-victory', showModal: true onSpellChanged: (e) -> @@ -113,7 +113,7 @@ module.exports = class CastButtonView extends CocoView @winnable = winnable @$el.toggleClass 'winnable', @winnable Backbone.Mediator.publish 'tome:winnability-updated', winnable: @winnable, level: @options.level - if @options.level.get 'hidesRealTimePlayback' + if @options.level.get('hidesRealTimePlayback') or @options.level.isType('web-dev') @$el.find('.done-button').toggle @winnable else if @winnable and @options.level.get('slug') in ['course-thornbush-farm', 'thornbush-farm'] @$el.find('.submit-button').show() # Hide submit until first win so that script can explain it.