mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Fixed name ordering in the thang components editor.
This commit is contained in:
parent
5b5bceda3a
commit
39d0df5153
2 changed files with 10 additions and 5 deletions
|
@ -78,6 +78,8 @@ module.exports = class ThangComponentsEditView extends CocoView
|
|||
},
|
||||
data: $.extend true, {}, components
|
||||
callbacks: {select: @onSelectComponent, change: @onComponentsTreemaChanged}
|
||||
nodeClasses:
|
||||
'object': ThangComponentsObjectNode
|
||||
|
||||
@componentsTreema = @$el.find('#thang-components-column .treema').treema treemaOptions
|
||||
@componentsTreema.build()
|
||||
|
@ -345,11 +347,14 @@ module.exports = class ThangComponentsEditView extends CocoView
|
|||
@onComponentsChanged()
|
||||
|
||||
|
||||
class ThangComponentsArrayNode extends TreemaArrayNode
|
||||
valueClass: 'treema-thang-components-array'
|
||||
sort: true
|
||||
class ThangComponentsObjectNode extends TreemaObjectNode
|
||||
getChildren: ->
|
||||
children = super(arguments...)
|
||||
children.sort(@sortFunction)
|
||||
|
||||
sortFunction: (a, b) =>
|
||||
a = a.value ? a.defaultData
|
||||
b = b.value ? b.defaultData
|
||||
a = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, a.original, a.majorVersion)
|
||||
b = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, b.original, b.majorVersion)
|
||||
return 0 if not (a or b)
|
||||
|
|
|
@ -44,9 +44,9 @@ responses =
|
|||
module.exports = ->
|
||||
view = new ThangComponentEditView({
|
||||
components: [
|
||||
{ original: 'A', majorVersion: 0, config: {propA: 1, propB: 'string'} }
|
||||
{ original: 'B', majorVersion: 0 }
|
||||
{ original: 'C', majorVersion: 0 }
|
||||
{ original: 'A', majorVersion: 0, config: {propA: 1, propB: 'string'} }
|
||||
]
|
||||
thangType: new ThangType({
|
||||
components: [
|
||||
|
|
Loading…
Reference in a new issue