mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-27 14:33:59 -04:00
Merge branch 'master' into china
This commit is contained in:
commit
a9a3689e15
3 changed files with 32 additions and 19 deletions
app
locale
templates/play/level/tome
views/play/level/tome
|
@ -442,7 +442,7 @@
|
|||
managed_subs: "Managed Subscriptions"
|
||||
managed_subs_desc: "Add subscriptions for other players (students, children, etc.)"
|
||||
group_discounts: "Group discounts"
|
||||
group_discounts_1st: "1st subscription"
|
||||
group_discounts_1st: "1st subscription" # {change}
|
||||
group_discounts_full: "Full price"
|
||||
group_discounts_2nd: "Subscriptions 2-11"
|
||||
group_discounts_20: "20% off"
|
||||
|
@ -577,7 +577,7 @@
|
|||
retrostyle_blurb: "RetroStyle Games"
|
||||
|
||||
teachers:
|
||||
title: "CodeCombat: Info for Teachers"
|
||||
title: "CodeCombat: Info for Teachers" # {change}
|
||||
intro_1: "CodeCombat is an online game that teaches programming. Students write code in real programming languages."
|
||||
intro_2: "No experience required!"
|
||||
free_title: "How much does it cost?"
|
||||
|
@ -606,8 +606,8 @@
|
|||
how_much_4: "Additionally, we provide discounts for larger groups:"
|
||||
group_discounts_1: "We also offer group discounts for bulk subscriptions."
|
||||
sys_requirements_title: "System Requirements"
|
||||
sys_requirements_1: "A modern web browser. Newer versions of Chrome, Firefox, or Safari. Internet Explorer 9 or later."
|
||||
sys_requirements_2: "CodeCombat is not supported on iPad yet."
|
||||
sys_requirements_1: "A modern web browser. Newer versions of Chrome, Firefox, or Safari. Internet Explorer 9 or later." # {change}
|
||||
sys_requirements_2: "CodeCombat is not supported on iPad yet." # {change}
|
||||
|
||||
versions:
|
||||
save_version_title: "Save New Version"
|
||||
|
|
|
@ -73,17 +73,17 @@ if !selectedMethod
|
|||
.docs-ace-container
|
||||
.docs-ace
|
||||
if language == 'javascript'
|
||||
span= doc.owner + '.' + doc.name + '(' + argumentExamples.join(', ') + ');'
|
||||
span= doc.owner + '.' + docName + '(' + argumentExamples.join(', ') + ');'
|
||||
else if language == 'coffeescript'
|
||||
span= doc.ownerName + (doc.ownerName == '@' ? '' : '.') + doc.name + ' ' + argumentExamples.join(', ')
|
||||
span= doc.ownerName + (doc.ownerName == '@' ? '' : '.') + docName + ' ' + argumentExamples.join(', ')
|
||||
else if language == 'python'
|
||||
span= doc.ownerName + '.' + doc.name + '(' + argumentExamples.join(', ') + ')'
|
||||
span= doc.ownerName + '.' + docName + '(' + argumentExamples.join(', ') + ')'
|
||||
else if language == 'clojure'
|
||||
span= '(.' + doc.name + ' ' + doc.ownerName + ' ' + argumentExamples.join(', ') + ')'
|
||||
span= '(.' + docName + ' ' + doc.ownerName + ' ' + argumentExamples.join(', ') + ')'
|
||||
else if language == 'lua'
|
||||
span= doc.ownerName + ':' + doc.name + '(' + argumentExamples.join(', ') + ')'
|
||||
span= doc.ownerName + ':' + docName + '(' + argumentExamples.join(', ') + ')'
|
||||
else if language == 'io'
|
||||
span= (doc.ownerName == 'this' ? '' : doc.ownerName + ' ') + doc.name + '(' + argumentExamples.join(', ') + ')'
|
||||
span= (doc.ownerName == 'this' ? '' : doc.ownerName + ' ') + docName + '(' + argumentExamples.join(', ') + ')'
|
||||
|
||||
if (doc.type != 'function' && doc.type != 'snippet') || doc.name == 'now'
|
||||
p.value
|
||||
|
|
|
@ -55,16 +55,17 @@ module.exports = class DocFormatter
|
|||
when 'coffeescript' then '@'
|
||||
else 'this'
|
||||
if @doc.type is 'function'
|
||||
[docName, args] = @getDocNameAndArguments()
|
||||
sep = {clojure: ' '}[@options.language] ? ', '
|
||||
argNames = (arg.name for arg in @doc.args ? []).join sep
|
||||
argNames = args.join sep
|
||||
argString = if argNames then '__ARGS__' else ''
|
||||
@doc.shortName = switch @options.language
|
||||
when 'coffeescript' then "#{ownerName}#{if ownerName is '@' then '' else '.'}#{@doc.name}#{if argString then ' ' + argString else '()'}"
|
||||
when 'python' then "#{ownerName}.#{@doc.name}(#{argString})"
|
||||
when 'lua' then "#{ownerName}:#{@doc.name}(#{argString})"
|
||||
when 'clojure' then "(.#{@doc.name} #{ownerName}#{if argNames then ' ' + argString else ''})"
|
||||
when 'io' then "#{if ownerName is 'this' then '' else ownerName + ' '}#{@doc.name}#{if argNames then '(' + argNames + ')' else ''}"
|
||||
else "#{ownerName}.#{@doc.name}(#{argString});"
|
||||
when 'coffeescript' then "#{ownerName}#{if ownerName is '@' then '' else '.'}#{docName}#{if argString then ' ' + argString else '()'}"
|
||||
when 'python' then "#{ownerName}.#{docName}(#{argString})"
|
||||
when 'lua' then "#{ownerName}:#{docName}(#{argString})"
|
||||
when 'clojure' then "(.#{docName} #{ownerName}#{if argNames then ' ' + argString else ''})"
|
||||
when 'io' then "#{if ownerName is 'this' then '' else ownerName + ' '}#{docName}#{if argNames then '(' + argNames + ')' else ''}"
|
||||
else "#{ownerName}.#{docName}(#{argString});"
|
||||
else
|
||||
@doc.shortName = switch @options.language
|
||||
when 'coffeescript' then "#{ownerName}#{if ownerName is '@' then '' else '.'}#{@doc.name}"
|
||||
|
@ -76,7 +77,7 @@ module.exports = class DocFormatter
|
|||
@doc.shorterName = @doc.shortName
|
||||
if @doc.type is 'function' and argString
|
||||
@doc.shortName = @doc.shorterName.replace argString, argNames
|
||||
@doc.shorterName = @doc.shorterName.replace argString, (if argNames.length > 6 then '...' else argNames)
|
||||
@doc.shorterName = @doc.shorterName.replace argString, (if not /cast[A-Z]/.test(@doc.name) and argNames.length > 6 then '...' else argNames)
|
||||
if @options.language is 'javascript'
|
||||
@doc.shorterName = @doc.shortName.replace ';', ''
|
||||
if @doc.owner is 'this' or @options.tabbify
|
||||
|
@ -119,7 +120,10 @@ module.exports = class DocFormatter
|
|||
obj[prop] = @replaceSpriteName obj[prop] # Do this before using the template, otherwise marked might get us first.
|
||||
|
||||
formatPopover: ->
|
||||
content = popoverTemplate doc: @doc, language: @options.language, value: @formatValue(), marked: marked, argumentExamples: (arg.example or arg.default or arg.name for arg in @doc.args ? []), writable: @options.writable, selectedMethod: @options.selectedMethod, cooldowns: @inferCooldowns(), item: @options.item
|
||||
[docName, args] = @getDocNameAndArguments()
|
||||
argumentExamples = (arg.example or arg.default or arg.name for arg in @doc.args ? [])
|
||||
argumentExamples.unshift args[0] if args.length > argumentExamples.length
|
||||
content = popoverTemplate doc: @doc, docName: docName, language: @options.language, value: @formatValue(), marked: marked, argumentExamples: argumentExamples, writable: @options.writable, selectedMethod: @options.selectedMethod, cooldowns: @inferCooldowns(), item: @options.item
|
||||
owner = if @doc.owner is 'this' then @options.thang else window[@doc.owner]
|
||||
content = @replaceSpriteName content
|
||||
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
|
||||
|
@ -130,6 +134,15 @@ module.exports = class DocFormatter
|
|||
name = 'hero' if /Hero Placeholder/.test @options.thang.id
|
||||
s.replace /#{spriteName}/g, name
|
||||
|
||||
getDocNameAndArguments: ->
|
||||
return [@doc.name, []] unless @doc.type is 'function'
|
||||
docName = @doc.name
|
||||
args = (arg.name for arg in @doc.args ? [])
|
||||
if /cast[A-Z]/.test docName
|
||||
docName = 'cast'
|
||||
args.unshift '"' + _.string.dasherize(@doc.name).replace('cast-', '') + '"'
|
||||
[docName, args]
|
||||
|
||||
formatValue: (v) ->
|
||||
return null if @doc.type is 'snippet'
|
||||
return @options.thang.now() if @doc.name is 'now'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue