Merge branch 'master' into production

This commit is contained in:
Nick Winter 2015-03-14 09:57:54 -07:00
commit 83dcc9ee85
9 changed files with 61 additions and 38 deletions

View file

@ -9,7 +9,6 @@ ThangType = require 'models/ThangType'
lastHeroesEarned = me.get('earned')?.heroes ? []
lastHeroesPurchased = me.get('purchased')?.heroes ? []
module.exports = class LevelSetupManager extends CocoClass
constructor: (@options) ->
@ -55,6 +54,10 @@ module.exports = class LevelSetupManager extends CocoClass
loadModals: ->
# build modals and prevent them from disappearing.
if @level.get('slug') is 'zero-sum'
@session.set 'heroConfig', {"thangType":"52fd1524c7e6cf99160e7bc9","inventory":{"misc-0":"53e2396a53457600003e3f0f","programming-book":"546e266e9df4a17d0d449be5","minion":"54eb5dbc49fa2d5c905ddf56","feet":"53e214f153457600003e3eab","right-hand":"544d88478494308424f56505","left-hand":"546375a43839c6e02811d311","wrists":"54693797a2b1f53ce79443e9","gloves":"5469425ca2b1f53ce7944421","torso":"546d4a549df4a17d0d449a97","neck":"54693274a2b1f53ce79443c9","eyes":"546941fda2b1f53ce794441d","head":"546d4ca19df4a17d0d449abf"}}
@onInventoryModalPlayClicked()
return
@heroesModal = new PlayHeroesModal({supermodel: @supermodel, session: @session, confirmButtonI18N: 'play.next', level: @level, hadEverChosenHero: @options.hadEverChosenHero})
@inventoryModal = new InventoryModal({supermodel: @supermodel, session: @session, level: @level})
@heroesModalDestroy = @heroesModal.destroy
@ -86,7 +89,6 @@ module.exports = class LevelSetupManager extends CocoClass
# @inventoryModal.onShown() # replace?
@playSound 'game-menu-open'
#- Modal events
onceHeroLoaded: (e) ->

View file

@ -432,8 +432,7 @@
subscription_required_to_play: "You'll need a subscription to play this level."
unlock_help_videos: "Subscribe to unlock all video tutorials."
# Accounts Subscription View
personal_sub: "Personal Subscription"
personal_sub: "Personal Subscription" # Accounts Subscription View below
loading_info: "Loading subscription information..."
managed_by: "Managed by"
will_be_cancelled: "Will be cancelled on"

View file

@ -64,7 +64,7 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
achievements: "Logros" # Tooltip on achievement list button from /play
account: "Cuenta" # Tooltip on account button from /play
settings: "Configuración" # Tooltip on settings button from /play
# poll: "Poll" # Tooltip on poll button from /play
poll: "Encuestas" # Tooltip on poll button from /play
next: "Próximo" # Go from choose hero to choose inventory before playing a level
change_hero: "Cambiar héroe" # Go back from choose inventory to choose hero
choose_inventory: "Equipar objetos"
@ -728,7 +728,7 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
thang_title: "Editor de Thangs"
level_title: "Editor de Nivel"
achievement_title: "Editor de logros"
# poll_title: "Poll Editor"
poll_title: "Editor de Encuesta"
back: "Atrás"
revert: "Revertir"
revert_models: "Revertir Modelos"
@ -789,13 +789,13 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
new_level_title_login: "Ingresa para Crear un Nuevo Nivel"
new_achievement_title: "Crear un Nuevo Logro"
new_achievement_title_login: "Ingresa para Crear un Nuevo Logro"
# new_poll_title: "Create a New Poll"
# new_poll_title_login: "Log In to Create a New Poll"
new_poll_title: "Crear una nueva encuesta"
new_poll_title_login: "Ingresa para crear una nueva encuesta"
article_search_title: "Buscar Artículos aquí"
thang_search_title: "Buscar tipos de Thang aquí"
level_search_title: "Buscar Niveles aquí"
achievement_search_title: "Buscar logros"
# poll_search_title: "Search Polls"
poll_search_title: "Buscar Encuesta"
read_only_warning2: "Nota: no puedes guardar ediciones aquí, porque no estas logeado."
no_achievements: "No hay logros agregados en este nivel por ahora."
# achievement_query_misc: "Key achievement off of miscellanea"
@ -973,7 +973,7 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
payments: "Pagos"
purchased: "Comprado"
subscription: "Suscripción"
# invoices: "Invoices"
invoices: "Facturas"
service_apple: "Apple"
service_web: "Web"
paid_on: "Pagado en"
@ -990,15 +990,15 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
status_unsubscribed_active: "No estas suscripto y no se te cobrará, pero tu cuenta está activa por ahora."
status_unsubscribed: "Obtén acceso a nuevos niveles, heroés, items y gemas extras con la suscripción a CodeCombat!"
# account_invoices:
# amount: "Amount in US dollars"
# declined: "Your card was declined"
# invalid_amount: "Please enter a US dollar amount."
# not_logged_in: "Log in or create an account to access invoices."
# pay: "Pay Invoice"
# purchasing: "Purchasing..."
# retrying: "Server error, retrying."
# success: "Successfully paid. Thanks!"
account_invoices:
amount: "Cantidad en dólares."
declined: "La tarjeta fue rechazada."
invalid_amount: "Por favor ingrese cantidad en dólares."
not_logged_in: "Ingresate o crea una cuenta para acceder a las facturas."
pay: "Pagar Factura"
purchasing: "Comprando..."
retrying: "Error de Servidor, reintentando..."
success: "Listo, fue cobrado. Gracias!"
loading_error:
could_not_load: "Error cargando del servidor"
@ -1060,8 +1060,8 @@ module.exports = nativeDescription: "Español (América Latina)", englishDescrip
feedback: "Feedback"
payment_info: "Información de pago"
campaigns: "Campañas"
# poll: "Poll"
# user_polls_record: "Poll Voting History"
poll: "Encuesta"
user_polls_record: "Historia de Visitas de Encuestas"
delta:
added: "Agregado"

View file

@ -430,7 +430,30 @@ module.exports = nativeDescription: "русский", englishDescription: "Russi
parents_blurb3: "Без риска: 100% гарантия возрата денег, возможность отписаться в 1 клик."
stripe_description: "Месячная подписка"
subscription_required_to_play: "Чтобы сыграть этот уровень нужна подписка."
unlock_help_videos: "Подпишитесь, чтобы разблокировать все обучающие видео."
unlock_help_videos: "Подпишитесь, чтобы разблокировать все обучающие видео." # Accounts Subscription View
personal_sub: "Личная подписка"
loading_info: "Загружаем информацию о подписке..."
managed_by: "Управляется"
will_be_cancelled: "Будет отменена"
currently_free: "Сейчас вы имеете бесплатную подписку"
currently_free_until: "Сейчас вы имеете бесплатную подписку до"
was_free_until: "Вы имели бесплатную подписку до"
managed_subs: "Управляемые подписки"
managed_subs_desc: "Добавьте подписки для других игроков (студенты, дети и т.д.)"
group_discounts: "Группые скидки"
group_discounts_1st: "1ая подписка (включая вашу)"
group_discounts_full: "Полная стоимость"
group_discounts_2nd: "Подписки со 2-й по 11-ю"
group_discounts_20: "20% скидка"
group_discounts_12th: "Подписки 12-я и больше"
group_discounts_40: "40% скидка"
subscribing: "Подписываемся..."
recipient_emails_placeholder: "Введите email-адреса для подписки, по одному на каждой линии."
subscribe_users: "Подписать пользователей"
users_subscribed: "Подписанные пользователи:"
no_users_subscribed: "Нет подписанных пользователей. Пожалуйста, проверьте список email-адресов еще раз."
current_recipients: "Текущие получатели"
unsubscribing: "Отписываемся..."
choose_hero:
choose_hero: "Выберите героя"

View file

@ -70,7 +70,7 @@ block content
if personalSub.nextPaymentDate
tr
th(data-i18n="account.next_payment")
td= moment(nextPaymentDate).format('l')
td= moment(personalSub.nextPaymentDate).format('l')
if personalSub.cost
tr
th(data-i18n="account.cost")

View file

@ -584,8 +584,7 @@ module.exports = class CampaignView extends RootView
onRecordSync.call @ if @userPollsRecord.loaded
loadPoll: ->
lastPollID = _.last _.keys @userPollsRecord.get 'polls'
url = "/db/poll/#{lastPollID or '-'}/next"
url = "/db/poll/#{@userPollsRecord.id}/next"
@poll = new Poll().setURL url
onPollSync = ->
return if @destroyed

View file

@ -270,7 +270,9 @@ module.exports = class PlayLevelView extends RootView
onSessionLoaded: (e) ->
Backbone.Mediator.publish "ipad:language-chosen", language: e.session.get('codeLanguage') ? "python"
# Just the level and session have been loaded by the level loader
if e.level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop'] and not _.size e.session.get('heroConfig')?.inventory ? {}
if e.level.get('slug') is 'zero-sum'
e.session.set 'heroConfig', {"thangType":"52fd1524c7e6cf99160e7bc9","inventory":{"misc-0":"53e2396a53457600003e3f0f","programming-book":"546e266e9df4a17d0d449be5","minion":"54eb5dbc49fa2d5c905ddf56","feet":"53e214f153457600003e3eab","right-hand":"544d88478494308424f56505","left-hand":"546375a43839c6e02811d311","wrists":"54693797a2b1f53ce79443e9","gloves":"5469425ca2b1f53ce7944421","torso":"546d4a549df4a17d0d449a97","neck":"54693274a2b1f53ce79443c9","eyes":"546941fda2b1f53ce794441d","head":"546d4ca19df4a17d0d449abf"}}
else if e.level.get('type', true) in ['hero', 'hero-ladder', 'hero-coop'] and not _.size e.session.get('heroConfig')?.inventory ? {}
@setupManager?.destroy()
@setupManager = new LevelSetupManager({supermodel: @supermodel, levelID: @levelID, parent: @, session: @session})
@setupManager.open()

View file

@ -1,4 +1,5 @@
Poll = require './Poll'
UserPollsRecord = require './UserPollsRecord'
Handler = require '../commons/Handler'
async = require 'async'
mongoose = require 'mongoose'
@ -23,22 +24,19 @@ PollHandler = class PollHandler extends Handler
return @getNextPoll(req, res, args[0]) if relationship is 'next'
super arguments...
getNextPoll: (req, res, lastPollID) ->
@findPollPriority lastPollID, (err, lastPriority) =>
getNextPoll: (req, res, userPollsRecordID) ->
UserPollsRecord.findOne(_id: mongoose.Types.ObjectId(userPollsRecordID)).lean().exec (err, userPollsRecord) =>
return @sendDatabaseError(res, err) if err
@getNextPollAfterPriority lastPriority, (err, poll) =>
answeredPolls = _.keys(userPollsRecord?.polls ? {})
if answeredPolls.length
query = {_id: {$nin: (mongoose.Types.ObjectId(pollID) for pollID in answeredPolls)}}
else
query = {}
Poll.findOne(query).sort('priority').exec (err, poll) =>
return @sendDatabaseError(res, err) if err
return @sendNotFoundError(res) unless poll
@sendSuccess res, @formatEntity(req, poll)
findPollPriority: (lastPollID, callback) ->
return callback null, -9001 unless lastPollID and lastPollID isnt '-'
Poll.findById mongoose.Types.ObjectId(lastPollID), 'priority', {lean: true}, (err, poll) ->
callback err, poll?.priority
getNextPollAfterPriority: (priority, callback) ->
Poll.findOne({priority: {$gt: priority}}).sort('priority').exec callback
delete: (req, res, slugOrID) ->
return @sendForbiddenError res unless req.user?.isAdmin()
@getDocumentForIdOrSlug slugOrID, (err, document) =>

View file

@ -139,7 +139,7 @@ module.exports.getTwoGames = (req, res) ->
ogresGameID = req.body.ogresGameID
return if simulatorIsTooOld req, res
#ladderGameIDs = ['greed', 'criss-cross', 'brawlwood', 'dungeon-arena', 'gold-rush', 'sky-span'] # Let's not give any extra simulations to old ladders.
ladderGameIDs = ['dueling-grounds', 'cavern-survival', 'multiplayer-treasure-grove', 'harrowland']
ladderGameIDs = ['dueling-grounds', 'cavern-survival', 'multiplayer-treasure-grove', 'harrowland'] #, 'zero-sum']
levelID = _.sample ladderGameIDs
unless ogresGameID and humansGameID
async.map [{levelID: levelID, team: 'humans'}, {levelID: levelID, team: 'ogres'}], findRandomSession, (err, sessions) ->