Skip to content

Commit bef28ab

Browse files
committed
Reintroduced getChildSchema as a TreemaNode function so subclasses could override it still.
1 parent 1a5b23e commit bef28ab

File tree

5 files changed

+37
-28
lines changed

5 files changed

+37
-28
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"treema.js",
55
"treema.css"
66
],
7-
"version": "0.1.1",
7+
"version": "0.1.2",
88
"authors": [
99
"CodeCombat <[email protected]>"
1010
],

dev/js/treema.js

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class TreemaNode
7676
saveChanges: (oldData)->
7777
return if oldData is @data
7878
@addTrackedAction {'oldData':oldData, 'newData':@data, 'path':@getPath(), 'action':'edit'}
79+
getChildSchema: (key) -> TreemaNode.utils.getChildSchema(key, @schema)
7980
buildValueForDisplay: -> console.error('"buildValueForDisplay" has not been overridden.')
8081
buildValueForEditing: ->
8182
return unless @editable and @directlyEditable

src/core.coffee

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ do __init = ->
101101
({
102102
key: key
103103
value: value
104-
schema: TreemaNode.utils.getChildSchema(key, @schema)
104+
schema: @getChildSchema(key)
105105
} for value, key in @data)
106106

107107
buildValueForDisplay: (valEl, data) ->
@@ -181,13 +181,13 @@ do __init = ->
181181
keysAccountedFor.push(key)
182182
children.push({
183183
key: key,
184-
schema: TreemaNode.utils.getChildSchema(key, @schema)
184+
schema: @getChildSchema(key)
185185
defaultData: defaultData
186186
})
187187
continue
188188

189189
keysAccountedFor.push(key)
190-
schema = TreemaNode.utils.getChildSchema(key, @schema)
190+
schema = @getChildSchema(key)
191191
children.push({
192192
key: key
193193
value: @data[key]
@@ -201,7 +201,7 @@ do __init = ->
201201
children.push({
202202
key: key
203203
value: value
204-
schema: TreemaNode.utils.getChildSchema(key, @schema)
204+
schema: @getChildSchema(key)
205205
defaultData: @getDefaultDataForKey(key)
206206
})
207207

@@ -211,7 +211,7 @@ do __init = ->
211211
keysAccountedFor.push(key)
212212
children.push({
213213
key: key
214-
schema: TreemaNode.utils.getChildSchema(key, @schema)
214+
schema: @getChildSchema(key)
215215
defaultData: @getDefaultDataForKey(key)
216216
})
217217

@@ -221,7 +221,7 @@ do __init = ->
221221
keysAccountedFor.push(key)
222222
children.push({
223223
key: key
224-
schema: TreemaNode.utils.getChildSchema(key, @schema)
224+
schema: @getChildSchema(key)
225225
defaultData: @getDefaultDataForKey(key)
226226
})
227227

@@ -252,7 +252,7 @@ do __init = ->
252252
break
253253
i += 1
254254

255-
childSchema = TreemaNode.utils.getChildSchema(key, @schema)
255+
childSchema = @getChildSchema(key)
256256
name = childSchema.title or key
257257
if $.isPlainObject(value) or $.isArray(value)
258258
text.push "#{name}"
@@ -273,7 +273,7 @@ do __init = ->
273273
return unless @schema.required
274274
for key in @schema.required
275275
continue if @data[key]?
276-
helperTreema = TreemaNode.make(null, {schema: TreemaNode.utils.getChildSchema(key, @schema)}, @)
276+
helperTreema = TreemaNode.make(null, {schema: @getChildSchema(key)}, @)
277277
helperTreema.populateData()
278278
@data[key] = helperTreema.data
279279

@@ -393,7 +393,7 @@ do __init = ->
393393
return
394394

395395
addNewChildForKey: (key) ->
396-
schema = TreemaNode.utils.getChildSchema(key, @schema)
396+
schema = @getChildSchema(key)
397397
newTreema = TreemaNode.make(null, {schema: schema}, @, key)
398398
childNode = @createChildNode(newTreema)
399399
@findObjectInsertionPoint(key).before(childNode)

treema.js

Lines changed: 13 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)