Commit d7cbd1c8 by Calen Pennington

Don't do extra json conversion/de-conversion for data/children going to the cms

parent bb06a926
...@@ -277,11 +277,11 @@ def save_item(request): ...@@ -277,11 +277,11 @@ def save_item(request):
raise Http404 # TODO (vshnayder): better error raise Http404 # TODO (vshnayder): better error
if request.POST['data']: if request.POST['data']:
data = json.loads(request.POST['data']) data = request.POST['data']
modulestore().update_item(item_location, data) modulestore().update_item(item_location, data)
if request.POST['children']: if request.POST['children']:
children = json.loads(request.POST['children']) children = request.POST['children']
modulestore().update_children(item_location, children) modulestore().update_children(item_location, children)
# Export the course back to github # Export the course back to github
......
...@@ -11,9 +11,6 @@ class CMS.Models.Module extends Backbone.Model ...@@ -11,9 +11,6 @@ class CMS.Models.Module extends Backbone.Model
editUrl: -> editUrl: ->
"/edit_item?#{$.param(id: @get('id'))}" "/edit_item?#{$.param(id: @get('id'))}"
updateChildren: (children) ->
@set(children: JSON.stringify(children))
save: (args...) -> save: (args...) ->
@set(data: JSON.stringify(@module.save())) if @module @set(data: @module.save()) if @module
super(args...) super(args...)
...@@ -22,7 +22,7 @@ class CMS.Views.ModuleEdit extends Backbone.View ...@@ -22,7 +22,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
@$children.sortable( @$children.sortable(
placeholder: "ui-state-highlight" placeholder: "ui-state-highlight"
update: (event, ui) => update: (event, ui) =>
@model.updateChildren(@$children.find('.module-edit').map( @model.set(children: @$children.find('.module-edit').map(
(idx, el) -> $(el).data('id') (idx, el) -> $(el).data('id')
).toArray()) ).toArray())
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment