Fixed the patches view.

This commit is contained in:
Scott Erickson 2014-05-05 15:19:35 -07:00
parent d94856d00c
commit 8f9aea1b9b
2 changed files with 6 additions and 8 deletions

View file

@ -710,3 +710,4 @@
user_names: "User Names"
files: "Files"
top_simulators: "Top Simulators"
source_document: "Source Document"

View file

@ -17,14 +17,11 @@ module.exports = class PatchModal extends ModalView
constructor: (@patch, @targetModel, options) ->
super(options)
targetID = @patch.get('target').id
if false
@originalSource = targetModel.clone(false)
@onOriginalLoaded()
if targetID is @targetModel.id
@originalSource = @targetModel.clone(false)
else
@originalSource = new targetModel.constructor({_id:targetID})
@originalSource.fetch()
@listenToOnce @originalSource, 'sync', @onOriginalLoaded
@addResourceToLoad(@originalSource)
@originalSource = new @targetModel.constructor({_id:targetID})
@supermodel.loadModel @originalSource, 'source_document'
getRenderData: ->
c = super()
@ -35,7 +32,7 @@ module.exports = class PatchModal extends ModalView
c
afterRender: ->
return if @originalSource.loading
return unless @supermodel.finished()
headModel = null
if @targetModel.hasWriteAccess()
headModel = @originalSource.clone(false)