Sorting addable Thangs in a sensible order.

This commit is contained in:
Nick Winter 2014-09-11 13:34:06 -07:00
parent c08c279f8b
commit d3245948e2

View file

@ -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