MCPcopy Index your code
hub / github.com/codecombat/codecombat / makeNewModel

Method makeNewModel

app/views/editor/modal/NewModelModal.js:37–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 makeNewModel () {
38 const model = new this.modelClass()
39 const name = this.$el.find('#name').val()
40
41 if (!this.hasNoNameProperty) {
42 model.set('name', name)
43 }
44 if (this.modelClass.name === 'Level') {
45 model.set('tasks', this.modelClass.schema.default.tasks)
46 }
47 if (model.schema().properties.permissions) {
48 model.set('permissions', [{ access: 'owner', target: me.id }])
49 }
50 if (this.properties != null) { for (const key in this.properties) { const prop = this.properties[key]; model.set(key, prop) } }
51 return model
52 }
53
54 onModelSubmitted (e) {
55 e.preventDefault()

Callers 1

onModelSubmittedMethod · 0.95

Calls 2

schemaMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected