Fixed a bug with the thang component edit view: labels of new components not showing up.

This commit is contained in:
Scott Erickson 2014-08-26 14:15:21 -07:00
parent 2f72aa4f47
commit ab669739a6
3 changed files with 8 additions and 7 deletions

View file

@ -90,7 +90,8 @@ module.exports = class SuperModel extends Backbone.Model
getModelByOriginalAndMajorVersion: (ModelClass, original, majorVersion=0) ->
_.find @models, (m) ->
m.get('original') is original and m.get('version').major is majorVersion and m.constructor.className is ModelClass.className
return unless v = m.get('version')
m.get('original') is original and v.major is majorVersion and m.constructor.className is ModelClass.className
getModels: (ModelClass) ->
# can't use instanceof. SuperModel gets passed between windows, and one window

View file

@ -359,8 +359,8 @@ class LatestVersionReferenceNode extends TreemaNode
return @modelToString(docOrModel) if docOrModel instanceof CocoModel
return 'Unknown' unless @settings.supermodel?
m = CocoModel.getReferencedModel(@getData(), @schema)
urlGoingFor = m.url()
m = @settings.supermodel.getModel(urlGoingFor)
data = @getData()
m = @settings.supermodel.getModelByOriginalAndMajorVersion(m.constructor, data.original, data.majorVersion)
if @instance and not m
m = @instance
m.url = -> urlGoingFor

View file

@ -362,8 +362,8 @@ class ThangComponentsObjectNode extends TreemaObjectNode
return 0 if not (a or b)
return 1 if not b
return -1 if not a
return 1 if a.attributes.system > b.attributes.system
return -1 if a.attributes.system < b.attributes.system
return 1 if a.name > b.name
return -1 if a.name < b.name
return 1 if a.get('system') > b.get('system')
return -1 if a.get('system') < b.get('system')
return 1 if a.get('name') > b.get('name')
return -1 if a.get('name') < b.get('name')
return 0