mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -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
|
data: $.extend true, {}, components
|
||||||
callbacks: {select: @onSelectComponent, change: @onComponentsTreemaChanged}
|
callbacks: {select: @onSelectComponent, change: @onComponentsTreemaChanged}
|
||||||
|
nodeClasses:
|
||||||
|
'object': ThangComponentsObjectNode
|
||||||
|
|
||||||
@componentsTreema = @$el.find('#thang-components-column .treema').treema treemaOptions
|
@componentsTreema = @$el.find('#thang-components-column .treema').treema treemaOptions
|
||||||
@componentsTreema.build()
|
@componentsTreema.build()
|
||||||
|
@ -345,11 +347,14 @@ module.exports = class ThangComponentsEditView extends CocoView
|
||||||
@onComponentsChanged()
|
@onComponentsChanged()
|
||||||
|
|
||||||
|
|
||||||
class ThangComponentsArrayNode extends TreemaArrayNode
|
class ThangComponentsObjectNode extends TreemaObjectNode
|
||||||
valueClass: 'treema-thang-components-array'
|
getChildren: ->
|
||||||
sort: true
|
children = super(arguments...)
|
||||||
|
children.sort(@sortFunction)
|
||||||
|
|
||||||
sortFunction: (a, b) =>
|
sortFunction: (a, b) =>
|
||||||
|
a = a.value ? a.defaultData
|
||||||
|
b = b.value ? b.defaultData
|
||||||
a = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, a.original, a.majorVersion)
|
a = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, a.original, a.majorVersion)
|
||||||
b = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, b.original, b.majorVersion)
|
b = @settings.supermodel.getModelByOriginalAndMajorVersion(LevelComponent, b.original, b.majorVersion)
|
||||||
return 0 if not (a or b)
|
return 0 if not (a or b)
|
||||||
|
|
|
@ -44,9 +44,9 @@ responses =
|
||||||
module.exports = ->
|
module.exports = ->
|
||||||
view = new ThangComponentEditView({
|
view = new ThangComponentEditView({
|
||||||
components: [
|
components: [
|
||||||
{ original: 'A', majorVersion: 0, config: {propA: 1, propB: 'string'} }
|
|
||||||
{ original: 'B', majorVersion: 0 }
|
{ original: 'B', majorVersion: 0 }
|
||||||
{ original: 'C', majorVersion: 0 }
|
{ original: 'C', majorVersion: 0 }
|
||||||
|
{ original: 'A', majorVersion: 0, config: {propA: 1, propB: 'string'} }
|
||||||
]
|
]
|
||||||
thangType: new ThangType({
|
thangType: new ThangType({
|
||||||
components: [
|
components: [
|
||||||
|
|
Loading…
Reference in a new issue