mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Sorting addable Thangs in a sensible order.
This commit is contained in:
parent
c08c279f8b
commit
d3245948e2
1 changed files with 5 additions and 1 deletions
|
@ -33,7 +33,7 @@ module.exports = class AddThangsView extends CocoView
|
|||
models = @supermodel.getModels(ThangType)
|
||||
|
||||
thangTypes = _.uniq models, false, (thangType) -> thangType.get('original')
|
||||
thangTypes = _.reject thangTypes, (thangType) -> thangType.get('kind') is 'Mark'
|
||||
thangTypes = _.reject thangTypes, (thangType) -> thangType.get('kind') in ['Mark', 'Item']
|
||||
groupMap = {}
|
||||
for thangType in thangTypes
|
||||
kind = thangType.get('kind')
|
||||
|
@ -49,6 +49,10 @@ module.exports = class AddThangsView extends CocoView
|
|||
thangs: someThangTypes
|
||||
groups.push group
|
||||
|
||||
groups = _.sortBy groups, (group) ->
|
||||
index = ['Wall', 'Floor', 'Unit', 'Doodad', 'Misc'].indexOf group.name
|
||||
if index is -1 then 9001 else index
|
||||
|
||||
context.thangTypes = thangTypes
|
||||
context.groups = groups
|
||||
context
|
||||
|
|
Loading…
Reference in a new issue