Don't do extra json conversion/de-conversion for data/children going to the cms
This commit is contained in:
@@ -277,11 +277,11 @@ def save_item(request):
|
||||
raise Http404 # TODO (vshnayder): better error
|
||||
|
||||
if request.POST['data']:
|
||||
data = json.loads(request.POST['data'])
|
||||
data = request.POST['data']
|
||||
modulestore().update_item(item_location, data)
|
||||
|
||||
if request.POST['children']:
|
||||
children = json.loads(request.POST['children'])
|
||||
children = request.POST['children']
|
||||
modulestore().update_children(item_location, children)
|
||||
|
||||
# Export the course back to github
|
||||
|
||||
@@ -11,9 +11,6 @@ class CMS.Models.Module extends Backbone.Model
|
||||
editUrl: ->
|
||||
"/edit_item?#{$.param(id: @get('id'))}"
|
||||
|
||||
updateChildren: (children) ->
|
||||
@set(children: JSON.stringify(children))
|
||||
|
||||
save: (args...) ->
|
||||
@set(data: JSON.stringify(@module.save())) if @module
|
||||
@set(data: @module.save()) if @module
|
||||
super(args...)
|
||||
|
||||
@@ -22,7 +22,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
|
||||
@$children.sortable(
|
||||
placeholder: "ui-state-highlight"
|
||||
update: (event, ui) =>
|
||||
@model.updateChildren(@$children.find('.module-edit').map(
|
||||
@model.set(children: @$children.find('.module-edit').map(
|
||||
(idx, el) -> $(el).data('id')
|
||||
).toArray())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user