allow File to behave like normal backbone models
we had written some code for the backbone File model that assumes that you would always have a 'file' attribute (that is an actual filesytem object representing the bytes of the file), so you couldn't save or toJSON it if you were wanting to save it's other attributes (like name or parent_folder_id) this just fixes that. test plan: make sure that files still work as intended in quizzes or other places we use files. Change-Id: I4d9b7283b2d9d7160fd5b95819d9b7093f4c1cf0 Reviewed-on: https://gerrit.instructure.com/39916 Reviewed-by: Jason Madsen <jmadsen@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
2b30675ce0
commit
97387d48ac
|
@ -31,6 +31,7 @@ define [
|
|||
super
|
||||
|
||||
save: (attrs = {}, options = {}) ->
|
||||
return super unless @get('file')
|
||||
@set attrs
|
||||
dfrd = $.Deferred()
|
||||
el = @get('file')
|
||||
|
@ -61,6 +62,7 @@ define [
|
|||
options.error?(error)
|
||||
|
||||
toJSON: ->
|
||||
return super unless @get('file')
|
||||
_.pick(@attributes, 'file', _.keys(@uploadParams ? {})...)
|
||||
|
||||
present: ->
|
||||
|
|
Loading…
Reference in New Issue