mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Fixed spell palette doc duplication.
This commit is contained in:
parent
c8679c37de
commit
9cdc07d07c
5 changed files with 15 additions and 7 deletions
|
@ -181,7 +181,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
|||
victory_go_home: "Go Home"
|
||||
victory_review: "Tell us more!"
|
||||
victory_hour_of_code_done: "Are You Done?"
|
||||
victory_hour_of_code_done_yes: "Yes, I'm finished with my Hour of Code<sup>TM</sup>!"
|
||||
victory_hour_of_code_done_yes: "Yes, I'm finished with my Hour of Code™!"
|
||||
multiplayer_title: "Multiplayer Settings"
|
||||
multiplayer_link_description: "Give this link to anyone to have them join you."
|
||||
multiplayer_hint_label: "Hint:"
|
||||
|
|
|
@ -132,7 +132,7 @@ module.exports = class HUDView extends View
|
|||
createProperties: ->
|
||||
props = @$el.find('.thang-props')
|
||||
props.find(":not(.thang-name)").remove()
|
||||
props.find('.thang-name').text(if @thang.type then "#{@thang.id} - #{@thang.spriteName}" else @thang.id)
|
||||
props.find('.thang-name').text(if @thang.type then "#{@thang.id} - #{@thang.type}" else @thang.id)
|
||||
for prop in @thang.hudProperties ? []
|
||||
pel = @createPropElement prop
|
||||
continue unless pel?
|
||||
|
|
|
@ -54,7 +54,9 @@ module.exports = class DebugView extends View
|
|||
chain.unshift token.value
|
||||
if token and (token.value of @variableStates or token.value is "this")
|
||||
@variableChain = chain
|
||||
@pos = {left: e.domEvent.offsetX + 50, top: e.domEvent.offsetY + 50}
|
||||
offsetX = e.domEvent.offsetX ? e.clientX - $(e.domEvent.target).offset().left
|
||||
offsetY = e.domEvent.offsetY ? e.clientY - $(e.domEvent.target).offset().top
|
||||
@pos = {left: offsetX + 50, top: offsetY + 50}
|
||||
@markerRange = new Range pos.row, start, pos.row, end
|
||||
else
|
||||
@variableChain = @markerRange = null
|
||||
|
|
|
@ -111,7 +111,7 @@ module.exports = class SpellPaletteEntryView extends View
|
|||
formatPopover: ->
|
||||
content = popoverTemplate doc: @doc, value: @formatValue(), marked: marked, argumentExamples: (arg.example or arg.default or arg.name for arg in @doc.args ? [])
|
||||
owner = if @doc.owner is 'this' then @thang else window[@doc.owner]
|
||||
content = content.replace /#{spriteName}/g, @thang.spriteName # No quotes like we'd get with @formatValue
|
||||
content = content.replace /#{spriteName}/g, @thang.type ? @thang.spriteName # Prefer type, and excluded the quotes we'd get with @formatValue
|
||||
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
|
||||
|
||||
formatValue: (v) ->
|
||||
|
|
|
@ -42,15 +42,21 @@ module.exports = class SpellPaletteView extends View
|
|||
createPalette: ->
|
||||
lcs = @supermodel.getModels LevelComponent
|
||||
allDocs = {}
|
||||
allDocs[doc.name] = doc for doc in (lc.get('propertyDocumentation') ? []) for lc in lcs
|
||||
for lc in lcs
|
||||
for doc in (lc.get('propertyDocumentation') ? [])
|
||||
allDocs[doc.name] ?= []
|
||||
allDocs[doc.name].push doc
|
||||
#allDocs[doc.name] = doc for doc in (lc.get('propertyDocumentation') ? []) for lc in lcs
|
||||
|
||||
props = _.sortBy @thang.programmableProperties ? []
|
||||
snippets = _.sortBy @thang.programmableSnippets ? []
|
||||
shortenize = props.length + snippets.length > 6
|
||||
tabbify = props.length + snippets.length >= 10
|
||||
@entries = []
|
||||
@entries.push @addEntry(allDocs[prop] ? prop, shortenize, tabbify) for prop in props
|
||||
@entries.push @addEntry(allDocs[prop] ? prop, shortenize, tabbify, true) for prop in snippets
|
||||
for type, props of {props: props.slice(), snippets: snippets.slice()}
|
||||
for prop in props
|
||||
doc = allDocs[prop]?.shift() ? prop # Add one doc per instance of the prop name (this is super gimp)
|
||||
@entries.push @addEntry(doc, shortenize, tabbify, type is 'snippets')
|
||||
@entries = _.sortBy @entries, (entry) ->
|
||||
order = ['this', 'Math', 'Vector', 'snippets']
|
||||
index = order.indexOf entry.doc.owner
|
||||
|
|
Loading…
Reference in a new issue