mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Fixed #405 with a sledgehammer--just loading all Components before loading level editor.
This commit is contained in:
parent
e97bff6a3c
commit
ca75cc4a1a
2 changed files with 17 additions and 4 deletions
app
|
@ -2,6 +2,5 @@ LevelComponent = require 'models/LevelComponent'
|
|||
CocoCollection = require 'models/CocoCollection'
|
||||
|
||||
module.exports = class ComponentsCollection extends CocoCollection
|
||||
url: '/db/level_component/search'
|
||||
url: '/db/level.component/search'
|
||||
model: LevelComponent
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ CocoCollection = require 'models/CocoCollection'
|
|||
Surface = require 'lib/surface/Surface'
|
||||
Thang = require 'lib/world/thang'
|
||||
LevelThangEditView = require './thang/edit'
|
||||
ComponentsCollection = require 'collections/ComponentsCollection'
|
||||
|
||||
# Moving the screen while dragging thangs constants
|
||||
MOVE_MARGIN = 0.15
|
||||
|
@ -60,12 +61,25 @@ module.exports = class ThangsTabView extends View
|
|||
@thangTypes.once 'sync', @onThangTypesLoaded
|
||||
@thangTypes.fetch()
|
||||
|
||||
# just loading all Components for now: https://github.com/codecombat/codecombat/issues/405
|
||||
@componentCollection = @supermodel.getCollection new ComponentsCollection()
|
||||
@componentCollection.once 'sync', @onComponentsLoaded
|
||||
@componentCollection.fetch()
|
||||
|
||||
onThangTypesLoaded: =>
|
||||
return if @destroyed
|
||||
@supermodel.addCollection @thangTypes
|
||||
@supermodel.populateModel model for model in @thangTypes.models
|
||||
@startsLoading = false
|
||||
@startsLoading = not @componentCollection.loaded
|
||||
@render() # do it again but without the loading screen
|
||||
@onLevelLoaded level: @level if @level
|
||||
@onLevelLoaded level: @level if @level and not @startsLoading
|
||||
|
||||
onComponentsLoaded: =>
|
||||
return if @destroyed
|
||||
@supermodel.addCollection @componentCollection
|
||||
@startsLoading = not @thangTypes.loaded
|
||||
@render() # do it again but without the loading screen
|
||||
@onLevelLoaded level: @level if @level and not @startsLoading
|
||||
|
||||
getRenderData: (context={}) ->
|
||||
context = super(context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue