mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-22 10:55:19 -04:00
New models with default tasks are preintialized with these tasks.
This commit is contained in:
parent
ad28be1c64
commit
80c2a9e539
2 changed files with 4 additions and 0 deletions
app
|
@ -254,6 +254,7 @@ LevelSchema = c.object {
|
|||
'default':
|
||||
name: 'Ineffable Wizardry'
|
||||
description: 'This level is indescribably flarmy.'
|
||||
tasks: (name: t, complete: false for t in defaultTasks)
|
||||
documentation: {}
|
||||
scripts: []
|
||||
thangs: []
|
||||
|
|
|
@ -12,6 +12,7 @@ module.exports = class NewModelModal extends ModalView
|
|||
'submit form': 'onModelSubmitted'
|
||||
|
||||
constructor: (options) ->
|
||||
console.log options.model.schema
|
||||
super options
|
||||
@modelClass = options.model
|
||||
@modelLabel = options.modelLabel
|
||||
|
@ -22,6 +23,8 @@ module.exports = class NewModelModal extends ModalView
|
|||
model = new @modelClass
|
||||
name = @$el.find('#name').val()
|
||||
model.set('name', name)
|
||||
if @modelClass.schema.default?
|
||||
model.set('tasks', @modelClass.schema.default.tasks)
|
||||
if model.schema().properties.permissions
|
||||
model.set 'permissions', [{access: 'owner', target: me.id}]
|
||||
model.set(key, prop) for key, prop of @properties if @properties?
|
||||
|
|
Loading…
Reference in a new issue