Refactored a collection into its own file.

This commit is contained in:
Scott Erickson 2014-01-22 17:38:22 -08:00
parent 00a7de12c9
commit 4ff2abc4b0
2 changed files with 9 additions and 6 deletions

View file

@ -0,0 +1,7 @@
LevelComponent = require 'models/LevelComponent'
CocoCollection = require 'models/CocoCollection'
module.exports = class ComponentsCollection extends CocoCollection
url: '/db/level_component/search'
model: LevelComponent

View file

@ -3,13 +3,9 @@ template = require 'templates/editor/components/main'
Level = require 'models/Level'
LevelComponent = require 'models/LevelComponent'
CocoCollection = require 'models/CocoCollection'
ComponentsCollection = require 'collections/ComponentsCollection'
ComponentConfigView = require './config'
class ComponentsSearchCollection extends CocoCollection
url: '/db/level_component/search'
model: LevelComponent
module.exports = class ThangComponentEditView extends CocoView
id: "thang-components-edit-view"
template: template
@ -25,7 +21,7 @@ module.exports = class ThangComponentEditView extends CocoView
for model in [Level, LevelComponent]
(new model()).on 'schema-loaded', @render unless model.schema?.loaded
if not @componentCollection
@componentCollection = @supermodel.getCollection new ComponentsSearchCollection()
@componentCollection = @supermodel.getCollection new ComponentsCollection()
unless @componentCollection.loaded
@componentCollection.once 'sync', @onComponentsSync
@componentCollection.fetch()