Level editor displays thangs in a more orderly fashion.

This commit is contained in:
Scott Erickson 2014-01-20 23:02:23 -08:00
parent fabb40384c
commit e61d31f48c
4 changed files with 37 additions and 7 deletions

View file

@ -58,6 +58,17 @@
h3
margin: 0 -20px 0 0
width: 100%
h4
margin: 0 0 10px
clear: both
padding: 5px
background: rgba(150, 150, 150, 0.5)
width: $addPaletteWidth - 20px
box-sizing: border-box
.clearfix
margin-bottom: 20px
.add-thang-palette-icon
position: relative

View file

@ -12,9 +12,11 @@
.add-thangs-palette.thangs-column
h3(data-i18n="editor.level_tab_thangs_add") Add Thangs
#thangs-list
for thangType in thangTypes
div.add-thang-palette-icon(data-thang-type=thangType.name)
- path = '/file/db/thang.type/'+thangType.original+'/portrait.png'
img(title="Add " + thangType.name, src=path, alt="")
for group in groups
h4= group.name
for thangType in group.thangs
div.add-thang-palette-icon(data-thang-type=thangType.name)
- path = '/file/db/thang.type/'+thangType.original+'/portrait.png'
img(title="Add " + thangType.name, src=path, alt="")
div.clearfix
#editor-level-thang-edit.hide

View file

@ -63,7 +63,24 @@ module.exports = class ThangsTabView extends View
getRenderData: (context={}) =>
context = super(context)
context.thangTypes = (thangType.attributes for thangType in @supermodel.getModels(ThangType))
thangTypes = (thangType.attributes for thangType in @supermodel.getModels(ThangType))
thangTypes = _.uniq thangTypes, false, 'original'
groupMap = {}
for thangType in thangTypes
groupMap[thangType.kind] ?= []
groupMap[thangType.kind].push thangType
groups = []
for groupName in Object.keys(groupMap).sort()
someThangTypes = groupMap[groupName]
someThangTypes = _.sortBy someThangTypes, 'name'
group =
name: groupName
thangs: someThangTypes
groups.push group
context.thangTypes = thangTypes
context.groups = groups
context
afterRender: ->

View file

@ -92,7 +92,7 @@ module.exports = class Handler
unless @modelClass.schema.uses_coco_search
return @sendNotFoundError(res)
project = {original:1, name:1, version:1, description: 1, slug:1}
project = {original:1, name:1, version:1, description: 1, slug:1, kind: 1}
term = req.query.term
matchedObjects = []
filters = [{filter: {index: true}}]