Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-03-21 17:13:09 -07:00
commit 289dd4a445
13 changed files with 80 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -10,7 +10,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>CodeCombat</title>
<title>CodeCombat - Learn how to code by playing a game</title>
<meta name="description" content="Learn programming with a multiplayer live coding strategy game. You're a wizard, and your spells are JavaScript. Free, open source HTML5 game!">
<meta property="og:title" content="CodeCombat: Multiplayer Programming">

View file

@ -249,6 +249,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
av_other_debug_base_url: "Base (for debugging base.jade)"
u_title: "User List"
lg_title: "Latest Games"
clas: "CLAs"
editor:
main_title: "CodeCombat Editors"

View file

@ -113,7 +113,7 @@ module.exports = nativeDescription: "Português europeu", englishDescription: "P
title: "Definições do Wizard"
customize_avatar: "Altera o teu Avatar"
clothes: "Roupas"
# trim: "Trim"
trim: "Faixa"
cloud: "Nuvem"
spell: "Feitiço"
boots: "Botas"
@ -191,7 +191,7 @@ module.exports = nativeDescription: "Português europeu", englishDescription: "P
victory_ranking_game: "A submeter..."
# victory_return_to_ladder: "Return to Ladder"
victory_play_next_level: "Jogar próximo nível"
victory_go_home: "Ir para a Home"
victory_go_home: "Ir para o Inicio"
victory_review: "Conta-nos mais!"
victory_hour_of_code_done: "É tudo?"
victory_hour_of_code_done_yes: "Sim, a minha Hora de Código chegou ao fim!"
@ -199,19 +199,19 @@ module.exports = nativeDescription: "Português europeu", englishDescription: "P
multiplayer_link_description: "Dá este link a alguém para se juntar a ti."
multiplayer_hint_label: "Dica:"
multiplayer_hint: " Carrega no link para seleccionar tudp, depois pressiona ⌘-C ou Ctrl-C para copiar o link."
multiplayer_coming_soon: "Mais funcionalidades de multiplayer hão de vir!"
multiplayer_coming_soon: "Mais funcionalidades de multiplayer brevemente!"
guide_title: "Guia"
tome_minion_spells: "Feitiços dos teus Minions"
tome_read_only_spells: "Feitiços Read-Only"
tome_read_only_spells: "Feitiços apenas de leitura"
tome_other_units: "Outras Unidades"
# tome_cast_button_castable: "Cast Spell"
# tome_cast_button_casting: "Casting"
tome_cast_button_casting: "A lançar"
tome_cast_button_cast: "Lançar Feitiço"
# tome_autocast_delay: "Autocast Delay"
tome_select_spell: "Escolhe um Feitiço"
tome_select_a_thang: "Escolhe Alguém para "
tome_available_spells: "Feitiços disponíveis"
hud_continue: "Continuar (pressiona shift-space)"
hud_continue: "Continuar (shift-espaço)"
spell_saved: "Feitiço Guardado"
skip_tutorial: "Saltar (esc)"
# editor_config: "Editor Config"
@ -275,12 +275,12 @@ module.exports = nativeDescription: "Português europeu", englishDescription: "P
create_system_title: "Criar novo Sistema"
new_component_title: "Criar novo Componente"
new_component_field_system: "Sistema"
# new_article_title: "Create a New Article"
# new_thang_title: "Create a New Thang Type"
# new_level_title: "Create a New Level"
# article_search_title: "Search Articles Here"
# thang_search_title: "Search Thang Types Here"
# level_search_title: "Search Levels Here"
new_article_title: "Criar um Novo Artigo"
new_thang_title: "Criar um Novo tipo the Thang"
new_level_title: "Criar um Novo Nível"
article_search_title: "Procura Artigos Aqui"
thang_search_title: "Procura Tipos de Thang Aqui"
level_search_title: "Procura Níveis aqui"
article:
edit_btn_preview: "Visualizar"

View file

@ -29,3 +29,5 @@ block content
ul
li
a(href="/admin/base", data-i18n="admin.av_other_debug_base_url") Base (for debugging base.jade)
li
a(href="/admin/clas", data-i18n="admin.clas") CLAs

View file

@ -0,0 +1,15 @@
extends /templates/base
block content
h1(data-i18n="admin.clas") CLAs
table.table.table-striped.table-bordered.table-condensed#clas
tbody
each cla in clas
tr
td #{cla.name}
td #{cla.email}
td #{cla.githubUsername}
td #{cla.created}

View file

@ -5,7 +5,7 @@ body
.content.clearfix
.navbar-header
a.navbar-brand(href='/')
img(src="/images/pages/base/logo.png", title="CodeCombat", alt="CodeCombat")
img(src="/images/pages/base/logo.png", title="CodeCombat - Learn how to code by playing a game", alt="CodeCombat")
select.language-dropdown

View file

@ -94,8 +94,7 @@
label(for="github-username") Github Username
input(name="github-username", type="text")#github-username.form-control
span.help-block Please include if contributing to the
p(href="github.com/codecombat/codecombat") Github repository
| .
<a href="https://github.com/codecombat/codecombat">Github repository</a>.
p
| Please press I AGREE below to indicate your agreement.
button.btn#agreement-button I AGREE

View file

@ -0,0 +1,30 @@
View = require 'views/kinds/RootView'
template = require 'templates/admin/clas'
module.exports = class CLAsView extends View
id: "admin-clas-view"
template: template
startsLoading: true
constructor: (options) ->
super options
@getCLAs()
getCLAs: ->
CLACollection = Backbone.Collection.extend({
url: '/db/cla.submissions'
})
@clas = new CLACollection()
@clas.fetch()
@clas.on 'sync', @onCLAsLoaded, @
onCLAsLoaded: ->
@startsLoading = false
@render()
getRenderData: ->
c = super()
c.clas = []
unless @startsLoading
c.clas = _.uniq (_.sortBy (cla.attributes for cla in @clas.models), (m) -> m.githubUsername?.toLowerCase()), 'githubUsername'
c

View file

@ -32,8 +32,7 @@ module.exports = class CastButtonView extends View
@castOptions = $('.autocast-delays', @$el)
@castButton.on 'click', @onCastButtonClick
@castOptions.find('a').on 'click', @onCastOptionsClick
# TODO: use a User setting instead of localStorage
delay = localStorage.getItem 'autocastDelay'
delay = me.get('autocastDelay')
delay ?= 5000
if @levelID in ['brawlwood', 'brawlwood-tutorial', 'dungeon-arena', 'dungeon-arena-tutorial']
delay = 90019001
@ -88,7 +87,8 @@ module.exports = class CastButtonView extends View
#console.log "Set autocast delay to", delay
return unless delay
@autocastDelay = delay = parseInt delay
localStorage.setItem 'autocastDelay', delay
me.set('autocastDelay', delay)
me.save()
spell.view.setAutocastDelay delay for spellKey, spell of @spells
@castOptions.find('a').each ->
$(@).toggleClass('selected', parseInt($(@).attr('data-delay')) is delay)

View file

@ -2,8 +2,20 @@ log = require 'winston'
errors = require '../commons/errors'
handlers = require('../commons/mapping').handlers
schemas = require('../commons/mapping').schemas
mongoose = require 'mongoose'
module.exports.setup = (app) ->
# This is hacky and should probably get moved somewhere else, I dunno
app.get '/db/cla.submissions', (req, res) ->
res.setHeader('Content-Type', 'application/json')
collection = mongoose.connection.db.collection 'cla.submissions', (err, collection) ->
return log.error "Couldn't fetch CLA submissions because #{err}" if err
resultCursor = collection.find {}
resultCursor.toArray (err, docs) ->
return log.error "Couldn't fetch distinct CLA submissions because #{err}" if err
res.send docs
res.end
app.all '/db/*', (req, res) ->
res.setHeader('Content-Type', 'application/json')
module = req.path[4..]

View file

@ -18,7 +18,7 @@ UserHandler = class UserHandler extends Handler
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume',
'firstName', 'lastName', 'gender', 'facebookID', 'emailSubscriptions',
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
'wizard', 'aceConfig', 'simulatedBy', 'simulatedFor'
'wizard', 'aceConfig', 'simulatedBy', 'simulatedFor', 'autocastDelay'
]
jsonSchema: schema

View file

@ -17,7 +17,7 @@ UserSchema = c.object {},
wizardColor1: c.pct({title: 'Wizard Clothes Color'})
volume: c.pct({title: 'Volume'})
music: {type: 'boolean', default: true}
#autocastDelay, or more complex autocast options? I guess I'll see what I need when trying to hook up Scott's suggested autocast behavior
autocastDelay: {type: 'integer', 'default': 5000 }
emailSubscriptions: c.array {uniqueItems: true, 'default': ['announcement', 'notification']}, {'enum': emailSubscriptions}