mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Refactored a collection into its own file.
This commit is contained in:
parent
00a7de12c9
commit
4ff2abc4b0
2 changed files with 9 additions and 6 deletions
7
app/collections/ComponentsCollection.coffee
Normal file
7
app/collections/ComponentsCollection.coffee
Normal 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
|
||||
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue