mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
Merge pull request #2370 from amankr/newfeature
Issue #1785: Empty level editor folders removed
This commit is contained in:
commit
1513e20486
1 changed files with 13 additions and 0 deletions
|
@ -482,8 +482,21 @@ module.exports = class ThangsTabView extends CocoView
|
|||
return unless @selectedExtantThang
|
||||
thang = @getThangByID(@selectedExtantThang.id)
|
||||
@thangsTreema.delete(@pathForThang(thang))
|
||||
@deleteEmptyTreema(thang)
|
||||
Thang.resetThangIDs() # TODO: find some way to do this when we delete from treema, too
|
||||
|
||||
deleteEmptyTreema: (thang)->
|
||||
thangType = @supermodel.getModelByOriginal ThangType, thang.thangType
|
||||
children = @thangsTreema.childrenTreemas
|
||||
thangKind = children[thangType.get('kind', true)].data
|
||||
thangName = thangKind[thangType.get('name', true)]
|
||||
if Object.keys(thangName).length == 0
|
||||
folderPath = [thangType.get('kind', true), thangType.get('name', true)].join('/')
|
||||
@thangsTreema.delete(folderPath)
|
||||
if Object.keys(thangKind).length == 0
|
||||
folderPath = [thangType.get('kind', true)].join('/')
|
||||
@thangsTreema.delete(folderPath)
|
||||
|
||||
groupThangs: (thangs) ->
|
||||
# array of thangs -> foldered thangs
|
||||
grouped = {}
|
||||
|
|
Loading…
Reference in a new issue