Change delete_item to RESTful URL.
Part of STUD-847.
This commit is contained in:
@@ -70,6 +70,7 @@ define ["backbone", "jquery", "underscore", "gettext", "xblock/runtime.v1",
|
||||
(data) =>
|
||||
@model.set(id: data.id)
|
||||
@$el.data('id', data.id)
|
||||
@$el.data('update_url', data.update_url)
|
||||
@render()
|
||||
)
|
||||
|
||||
|
||||
@@ -82,9 +82,10 @@ define ["jquery", "jquery.ui", "backbone", "js/views/feedback_prompt", "js/views
|
||||
deleting = new NotificationView.Mini
|
||||
title: gettext('Deleting…')
|
||||
deleting.show()
|
||||
$.postJSON('/delete_item', {
|
||||
id: $component.data('id')
|
||||
}, =>
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: $component.data('update_url')
|
||||
}).success(=>
|
||||
$component.remove()
|
||||
deleting.hide()
|
||||
)
|
||||
|
||||
@@ -134,9 +134,10 @@ define ["jquery", "jquery.ui", "gettext", "backbone",
|
||||
title: gettext('Deleting…'),
|
||||
deleting.show()
|
||||
$component = $(event.currentTarget).parents('.component')
|
||||
$.postJSON('/delete_item', {
|
||||
id: $component.data('id')
|
||||
}, =>
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: $component.data('update_url')
|
||||
}).success(=>
|
||||
deleting.hide()
|
||||
analytics.track "Deleted a Component",
|
||||
course: course_location_analytics
|
||||
@@ -162,16 +163,16 @@ define ["jquery", "jquery.ui", "gettext", "backbone",
|
||||
|
||||
deleteDraft: (event) ->
|
||||
@wait(true)
|
||||
$.ajax({
|
||||
type: 'DELETE',
|
||||
url: @$el.data('update_url') + "?" + $.param({recurse: true})
|
||||
}).success(=>
|
||||
|
||||
$.postJSON('/delete_item', {
|
||||
id: @$el.data('id')
|
||||
delete_children: true
|
||||
}, =>
|
||||
analytics.track "Deleted Draft",
|
||||
course: course_location_analytics
|
||||
unit_id: unit_location_analytics
|
||||
analytics.track "Deleted Draft",
|
||||
course: course_location_analytics
|
||||
unit_id: unit_location_analytics
|
||||
|
||||
window.location.reload()
|
||||
window.location.reload()
|
||||
)
|
||||
|
||||
createDraft: (event) ->
|
||||
|
||||
Reference in New Issue
Block a user