mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -04:00
Merge branch 'master' into production
This commit is contained in:
commit
b49d880fd9
16 changed files with 70 additions and 60 deletions
|
@ -34,9 +34,15 @@
|
|||
<script src="/javascripts/aether.js" defer></script>
|
||||
<script src="/javascripts/app.js" defer></script> <!-- it's all Backbone! -->
|
||||
<script>
|
||||
|
||||
// Placeholder for iPad, which inspects the user object at the bottom of an injected page.
|
||||
window.userObject = "userObjectTag";
|
||||
window.me = {
|
||||
get: function(attribute) { return window.userObject[attribute]; }
|
||||
}
|
||||
|
||||
onLoad = function() {
|
||||
FastClick.attach(document.body);
|
||||
window.userObject = "userObjectTag";
|
||||
require('core/initialize');
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -20,6 +20,7 @@ module.exports = ModuleLoader = class ModuleLoader extends CocoClass
|
|||
wrapped = _.wrap window.require, (func, name, loaderPath) ->
|
||||
# vendor libraries aren't actually wrapped with common.js, so short circuit those requires
|
||||
return {} if _.string.startsWith(name, 'vendor/')
|
||||
name = 'core/auth' if name is 'lib/auth' # proxy for iPad until it's been updated to use the new, refactored location. TODO: remove this
|
||||
return func(name, loaderPath)
|
||||
_.extend wrapped, window.require # for functions like 'list'
|
||||
window.require = wrapped
|
||||
|
|
|
@ -176,7 +176,7 @@ module.exports = class LevelLoader extends CocoClass
|
|||
for obj in objUniq articleVersions
|
||||
url = "/db/article/#{obj.original}/version/#{obj.majorVersion}"
|
||||
@maybeLoadURL url, Article, 'article'
|
||||
if obj = @level.get 'nextLevel'
|
||||
if obj = @level.get 'nextLevel' # TODO: update to get next level from campaigns, not this old property
|
||||
url = "/db/level/#{obj.original}/version/#{obj.majorVersion}"
|
||||
@maybeLoadURL url, Level, 'level'
|
||||
|
||||
|
|
|
@ -680,9 +680,9 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
|
|||
diplomat_launch_url: "Launch im Oktober"
|
||||
diplomat_introduction_suf: "ist das es ein großes Interesse an CodeCombat in anderen Ländern gibt! Wir stellen eine Truppe von Übersetzern zusammen, die gewillt sind einen Satz Wörten in einen anderen Satz Wörter umzuwandeln um CodeCombat der Welt so zugänglich wie möglich zu machen. Wenn du es magst eine Vorschau von zukünftigem Content zu erhalten und diese Level so schnell wie möglich deinen Landsleuten zur Verfügung zu stellen, dann ist diese Klasse vielleicht für dich."
|
||||
# diplomat_attribute_1: "Fluency in English and the language you would like to translate to. When conveying complicated ideas, it's important to have a strong grasp in both!"
|
||||
# diplomat_i18n_page_prefix: "You can start translating our levels by going to our"
|
||||
# diplomat_i18n_page: "translations page"
|
||||
# diplomat_i18n_page_suffix: ", or our interface and website on GitHub."
|
||||
diplomat_i18n_page_prefix: "Du kanns anfangen unsere Levels zu übersetzen, indem du auf unsere"
|
||||
diplomat_i18n_page: "Übersetzungs-Seite"
|
||||
diplomat_i18n_page_suffix: "gehst, oder unsere Schnittstelle und Webseite bei GitHub benutzt."
|
||||
diplomat_join_pref_github: "Finde deine Sprachdatei "
|
||||
diplomat_github_url: "bei GitHub"
|
||||
diplomat_join_suf_github: ", editiere sie online und reiche einen Pull Request ein. Außerdem, hake die Checkbox unten an um über neue Entwicklungen bei der Internationalisierung auf dem laufenden zu bleiben!"
|
||||
|
@ -844,7 +844,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
|
|||
thang_names: "Thang Namen"
|
||||
files: "Dateien"
|
||||
top_simulators: "Top Simulatoren"
|
||||
# source_document: "Source Document"
|
||||
source_document: "Quelldokument"
|
||||
document: "Dokument"
|
||||
sprite_sheet: "Sprite Sheet"
|
||||
employers: "Arbeitgeber"
|
||||
|
@ -1086,7 +1086,7 @@ module.exports = nativeDescription: "Deutsch (Deutschland)", englishDescription:
|
|||
player_code: "Spieler Code"
|
||||
|
||||
employers:
|
||||
# deprecation_warning_title: "Sorry, CodeCombat is not recruiting right now."
|
||||
deprecation_warning_title: "Leider sucht CodeCombat derzeit keine neuen Mitarbeiter."
|
||||
# deprecation_warning: "We are focusing on beginner levels instead of finding expert developers for the time being."
|
||||
hire_developers_not_credentials: "Stellen Sie Entwickler ein, nicht Qualifikationen." # We are not actively recruiting right now, so there's no need to add new translations for the rest of this section.
|
||||
get_started: "Legen Sie los"
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
|||
play: "Jogar" # The big play button that just starts playing a level
|
||||
old_browser: "Ups, o teu navegador é demasiado antigo para que o CodeCombat funcione. Desculpa!" # Warning that shows up on really old Firefox/Chrome/Safari
|
||||
old_browser_suffix: "Mesmo assim podes tentar, mas provavelmente não irá funcionar."
|
||||
# ipad_browser: "Bad news: CodeCombat doesn't run on iPad in the browser. Good news: our native iPad app is awaiting Apple approval."
|
||||
ipad_browser: "Más notícias: o CodeCombat não funciona no navegador do iPad. Boas notícias: a nossa aplicação nativa para iPad está à espera da aprovação da Apple."
|
||||
campaign: "Campanha"
|
||||
for_beginners: "Para Iniciantes"
|
||||
multiplayer: "Multijogador" # Not currently shown on home page
|
||||
|
@ -915,9 +915,9 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription:
|
|||
cla_url: "CLA"
|
||||
contributor_description_suffix: "com o qual deves concordar antes de contribuir."
|
||||
code_title: "Código - MIT"
|
||||
# code_description_prefix: "All code owned by CodeCombat or hosted on codecombat.com, both in the GitHub repository or in the codecombat.com database, is licensed under the"
|
||||
code_description_prefix: "Todo o código do CodeCombat ou hospedado em codecombat.com, tanto no repositório do GitHub como na base de dados de codecombat.com, está resguardado sob a"
|
||||
mit_license_url: "licença do MIT"
|
||||
# code_description_suffix: "This includes all code in Systems and Components that are made available by CodeCombat for the purpose of creating levels."
|
||||
code_description_suffix: "Isto inclui todo o código dentro dos Sistemas e dos Componentes, o qual é disponibilizado pelo CodeCombat para a criação de níveis."
|
||||
art_title: "Arte/Música - Creative Commons "
|
||||
art_description_prefix: "Todos os conteúdos comuns estão disponíveis à luz da"
|
||||
cc_license_url: "Licença 'Creative Commons Attribution 4.0 International'"
|
||||
|
|
|
@ -124,6 +124,15 @@ module.exports = class User extends CocoModel
|
|||
application.tracker.identify gemPromptGroup: @gemPromptGroup unless me.isAdmin()
|
||||
@gemPromptGroup
|
||||
|
||||
getHideLockedLevelsGroup: ->
|
||||
return @hideLockedLevelsGroup if @hideLockedLevelsGroup
|
||||
group = if me.isAdmin() then 0 else me.get('testGroupNumber') % 2
|
||||
@hideLockedLevelsGroup = switch group
|
||||
when 0 then 'show'
|
||||
when 1 then 'hide'
|
||||
application.tracker.identify hideLockedLevelsGroup: @hideLockedLevelsGroup unless me.isAdmin()
|
||||
@hideLockedLevelsGroup
|
||||
|
||||
tiersByLevel = [-1, 0, 0.05, 0.14, 0.18, 0.32, 0.41, 0.5, 0.64, 0.82, 0.91, 1.04, 1.22, 1.35, 1.48, 1.65, 1.78, 1.96, 2.1, 2.24, 2.38, 2.55, 2.69, 2.86, 3.03, 3.16, 3.29, 3.42, 3.58, 3.74, 3.89, 4.04, 4.19, 4.32, 4.47, 4.64, 4.79, 4.96,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15
|
||||
]
|
||||
|
|
|
@ -5,7 +5,7 @@ block content
|
|||
div(class="job-profile-container")
|
||||
h1#login-message
|
||||
|Please
|
||||
a.auth-button login
|
||||
a.login-button login
|
||||
| to view this profile.
|
||||
else if user.loaded
|
||||
if allowedToEditJobProfile
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
p
|
||||
strong You must be signed in to sign this agreement.
|
||||
|
||||
button.btn.btn-primary.auth-button
|
||||
button.btn.btn-primary.login-button
|
||||
span(data-i18n="login.log_in") Log In
|
||||
span.spr.spl /
|
||||
span(data-i18n="login.sign_up") Create Account
|
||||
|
|
|
@ -7,7 +7,7 @@ if me.attributes.anonymous
|
|||
| To subscribe for class emails, you'll need to be logged in first.
|
||||
|
||||
strong.spl
|
||||
a.auth-button
|
||||
a.signup-button
|
||||
span(data-i18n="login.log_in") Log In
|
||||
span.spr.spl /
|
||||
span(data-i18n="login.sign_up") Create Account
|
|
@ -50,7 +50,7 @@ block modal-body-content
|
|||
block modal-footer-content
|
||||
if me.get('anonymous')
|
||||
p.sign-up-poke.hide
|
||||
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="modal/SignupModal", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
|
||||
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="core/AuthModal", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
|
||||
span(data-i18n="play_level.victory_sign_up_poke") Want to save your code? Create a free account!
|
||||
|
||||
div#totals.pull-left
|
||||
|
|
|
@ -23,7 +23,7 @@ block modal-footer-content
|
|||
a.btn.btn-primary(href="/", data-dismiss="modal", data-i18n="play_level.victory_go_home") Go Home
|
||||
if me.get('anonymous')
|
||||
p.sign-up-poke
|
||||
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="modal/SignupModal", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
|
||||
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="core/AuthModal", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
|
||||
span(data-i18n="play_level.victory_sign_up_poke") Want to save your code? Create a free account!
|
||||
p.clearfix
|
||||
else
|
||||
|
|
|
@ -10,30 +10,32 @@
|
|||
if !level.hidden
|
||||
- var next = level.id == nextLevel || (!seenNext && levelStatusMap[level.id] != "complete" && !level.locked && !level.disabled && (!level.practice || me.getBranchingGroup() == 'all-practice'));
|
||||
- seenNext = seenNext || next;
|
||||
div(style="left: #{level.x}%; bottom: #{level.y}%; background-color: #{level.color}", class="level" + (next ? " next" : "") + (level.disabled ? " disabled" : "") + (level.locked ? " locked" : "") + " " + levelStatusMap[level.id] || "", data-level-id=level.id, title=level.name + (level.disabled ? ' (Coming Soon to Adventurers)' : ''))
|
||||
a(href=level.type == 'hero' ? '#' : level.disabled ? "/play" : "/play/#{level.levelPath || 'level'}/#{level.id}", disabled=level.disabled, data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||
div(style="left: #{level.x}%; bottom: #{level.y}%", class="level-shadow" + (next ? " next" : "") + " " + levelStatusMap[level.id] || "")
|
||||
.level-info-container(data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||
div(class="level-info " + (levelStatusMap[level.id] || ""))
|
||||
h3= level.name + (level.disabled ? " (Coming soon!)" : (level.locked ? " (Locked)" : ""))
|
||||
.level-description= level.description
|
||||
if level.disabled
|
||||
p
|
||||
span.spr(data-i18n="play.awaiting_levels_adventurer_prefix") We release five levels per week.
|
||||
a.spr(href="/contribute/adventurer")
|
||||
strong(data-i18n="play.awaiting_levels_adventurer") Sign up as an Adventurer
|
||||
span.spl(data-i18n="play.awaiting_levels_adventurer_suffix") to be the first to play new levels.
|
||||
|
||||
- var playCount = levelPlayCountMap[level.id]
|
||||
if playCount && playCount.sessions > 20
|
||||
div
|
||||
span.spr #{playCount.sessions}
|
||||
span(data-i18n="play.players") players
|
||||
span.spr , #{Math.round(playCount.playtime / 3600)}
|
||||
span(data-i18n="play.hours_played") hours played
|
||||
.campaign-label(style="color: #{campaign.color}")= campaign.name
|
||||
if isIPadApp && !level.disabled && !level.locked
|
||||
button.btn.btn-success.btn-lg.start-level(data-i18n="common.play") Play
|
||||
//- A/B Test hiding locked levels
|
||||
if !hideLockedLevels || !level.locked
|
||||
div(style="left: #{level.x}%; bottom: #{level.y}%; background-color: #{level.color}", class="level" + (next ? " next" : "") + (level.disabled ? " disabled" : "") + (level.locked ? " locked" : "") + " " + levelStatusMap[level.id] || "", data-level-id=level.id, title=level.name + (level.disabled ? ' (Coming Soon to Adventurers)' : ''))
|
||||
a(href=level.type == 'hero' ? '#' : level.disabled ? "/play" : "/play/#{level.levelPath || 'level'}/#{level.id}", disabled=level.disabled, data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||
div(style="left: #{level.x}%; bottom: #{level.y}%", class="level-shadow" + (next ? " next" : "") + " " + levelStatusMap[level.id] || "")
|
||||
.level-info-container(data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name)
|
||||
div(class="level-info " + (levelStatusMap[level.id] || ""))
|
||||
h3= level.name + (level.disabled ? " (Coming soon!)" : (level.locked ? " (Locked)" : ""))
|
||||
.level-description= level.description
|
||||
if level.disabled
|
||||
p
|
||||
span.spr(data-i18n="play.awaiting_levels_adventurer_prefix") We release five levels per week.
|
||||
a.spr(href="/contribute/adventurer")
|
||||
strong(data-i18n="play.awaiting_levels_adventurer") Sign up as an Adventurer
|
||||
span.spl(data-i18n="play.awaiting_levels_adventurer_suffix") to be the first to play new levels.
|
||||
|
||||
- var playCount = levelPlayCountMap[level.id]
|
||||
if playCount && playCount.sessions > 20
|
||||
div
|
||||
span.spr #{playCount.sessions}
|
||||
span(data-i18n="play.players") players
|
||||
span.spr , #{Math.round(playCount.playtime / 3600)}
|
||||
span(data-i18n="play.hours_played") hours played
|
||||
.campaign-label(style="color: #{campaign.color}")= campaign.name
|
||||
if isIPadApp && !level.disabled && !level.locked
|
||||
button.btn.btn-success.btn-lg.start-level(data-i18n="common.play") Play
|
||||
if mapType === 'dungeon' && forestIsAvailable
|
||||
a#forest-link.glyphicon.glyphicon-share-alt.campaign-switch(href="/play/forest", data-i18n="[title]play.campaign_forest")
|
||||
if mapType === 'forest'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SignupModalView = require 'views/modal/SignupModal'
|
||||
AuthModal = require 'views/core/AuthModal'
|
||||
RootView = require 'views/core/RootView'
|
||||
{me} = require 'core/auth'
|
||||
contributorSignupAnonymousTemplate = require 'templates/contribute/contributor_signup_anonymous'
|
||||
|
@ -37,7 +37,7 @@ module.exports = class ContributeClassView extends RootView
|
|||
|
||||
me.setEmailSubscription subscription+'News', checked
|
||||
me.patch()
|
||||
@openModalView new SignupModalView() if me.get 'anonymous'
|
||||
@openModalView new AuthModal() if me.get 'anonymous'
|
||||
el.parent().find('.saved-notification').finish().show('fast').delay(3000).fadeOut(2000)
|
||||
|
||||
contributors: []
|
||||
|
|
|
@ -69,7 +69,9 @@ module.exports = class WorldMapView extends RootView
|
|||
@hadEverChosenHero = me.get('heroConfig')?.thangType
|
||||
@listenTo me, 'change:purchased', -> @renderSelectors('#gems-count')
|
||||
@listenTo me, 'change:spent', -> @renderSelectors('#gems-count')
|
||||
window.tracker?.trackEvent 'Loaded World Map', category: 'World Map', ['Google Analytics']
|
||||
# A/B Test hiding locked levels
|
||||
# window.tracker?.trackEvent 'Loaded World Map', category: 'World Map', ['Google Analytics']
|
||||
window.tracker?.trackEvent 'Loaded World Map', category: 'World Map', hideLockedLevelsGroup: me.getHideLockedLevelsGroup()
|
||||
|
||||
# If it's a new player who didn't appear to come from Hour of Code, we register her here without setting the hourOfCode property.
|
||||
elapsed = (new Date() - new Date(me.get('dateCreated')))
|
||||
|
@ -135,6 +137,8 @@ module.exports = class WorldMapView extends RootView
|
|||
context.mapType = _.string.slugify @terrain
|
||||
context.nextLevel = @nextLevel
|
||||
context.forestIsAvailable = @startedForestLevel or '541b67f71ccc8eaae19f3c62' in (me.get('earned')?.levels or [])
|
||||
# A/B Test hiding locked levels
|
||||
context.hideLockedLevels = me.getHideLockedLevelsGroup() is 'hide'
|
||||
context
|
||||
|
||||
afterRender: ->
|
||||
|
|
|
@ -417,7 +417,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
onShowVictory: (e) ->
|
||||
$('#level-done-button').show() unless @level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop']
|
||||
@showVictory() if e.showModal
|
||||
setTimeout(@preloadNextLevel, 3000)
|
||||
return if @victorySeen
|
||||
@victorySeen = true
|
||||
victoryTime = (new Date()) - @loadEndTime
|
||||
|
@ -457,14 +456,10 @@ module.exports = class PlayLevelView extends RootView
|
|||
viewClass: PlayLevelView,
|
||||
viewArgs: [{supermodel: if @hasReceivedMemoryWarning then null else @supermodel}, nextLevelID]}
|
||||
|
||||
getNextLevel: ->
|
||||
return null unless nextLevelOriginal = @level.get('nextLevel')?.original
|
||||
levels = @supermodel.getModels(Level)
|
||||
return l for l in levels when l.get('original') is nextLevelOriginal
|
||||
|
||||
getNextLevelID: ->
|
||||
return null unless nextLevel = @getNextLevel()
|
||||
nextLevelID = nextLevel.get('slug') or nextLevel.id
|
||||
for campaign in require('views/play/WorldMapView').campaigns
|
||||
for level in campaign.levels
|
||||
return level.nextLevels?.continue if level.id is @level.get('slug')
|
||||
|
||||
getNextLevelURL: ->
|
||||
return null unless @getNextLevelID()
|
||||
|
@ -483,14 +478,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
@bus.removeFirebaseData =>
|
||||
@bus.disconnect()
|
||||
|
||||
preloadNextLevel: =>
|
||||
# TODO: Loading models in the middle of gameplay causes stuttering. Most of the improvement in loading time is simply from passing the supermodel from this level to the next, but if we can find a way to populate the level early without it being noticeable, that would be even better.
|
||||
# return if @destroyed
|
||||
# return if @preloaded
|
||||
# nextLevel = @getNextLevel()
|
||||
# @supermodel.populateModel nextLevel
|
||||
# @preloaded = true
|
||||
|
||||
onSessionWillSave: (e) ->
|
||||
# Something interesting has happened, so (at a lower frequency), we'll save a screenshot.
|
||||
#@saveScreenshot e.session
|
||||
|
|
|
@ -225,7 +225,7 @@ module.exports.recordTwoGames = (req, res) ->
|
|||
updateSessions.bind(yetiGuru)
|
||||
indexNewScoreArray.bind(yetiGuru)
|
||||
addMatchToSessions.bind(yetiGuru)
|
||||
updateUserSimulationCounts.bind(yetiGuru, req.user._id)
|
||||
updateUserSimulationCounts.bind(yetiGuru, req.user?._id)
|
||||
], (err, successMessageObject) ->
|
||||
if err? then return errors.serverError res, "There was an error recording the single game:#{err}"
|
||||
sendResponseObject req, res, {'message': 'The single game was submitted successfully!'}
|
||||
|
@ -450,7 +450,7 @@ module.exports.processTaskResult = (req, res) ->
|
|||
updateSessions.bind(yetiGuru)
|
||||
indexNewScoreArray.bind(yetiGuru)
|
||||
addMatchToSessions.bind(yetiGuru)
|
||||
updateUserSimulationCounts.bind(yetiGuru, req.user._id)
|
||||
updateUserSimulationCounts.bind(yetiGuru, req.user?._id)
|
||||
determineIfSessionShouldContinueAndUpdateLog.bind(yetiGuru)
|
||||
findNearestBetterSessionID.bind(yetiGuru)
|
||||
addNewSessionsToQueue.bind(yetiGuru)
|
||||
|
@ -615,6 +615,7 @@ updateUserSimulationCounts = (reqUserID, callback) ->
|
|||
callback null
|
||||
|
||||
incrementUserSimulationCount = (userID, type, callback) =>
|
||||
return callback null unless userID
|
||||
inc = {}
|
||||
inc[type] = 1
|
||||
User.update {_id: userID}, {$inc: inc}, (err, affected) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue