Commit a4260ba5 by dragonfi

PR comments: rename events

parent 16a4dfee
......@@ -97,10 +97,6 @@ class DragAndDropBlock(XBlock):
fragment.initialize_js('DragAndDropBlock')
self.runtime.publish(self, 'drag-and-drop-v2.problem.shown',
{'component_id': self.scope_ids.usage_id, 'user_id': self.runtime.user_id}
)
return fragment
def studio_view(self, context):
......@@ -191,7 +187,7 @@ class DragAndDropBlock(XBlock):
# so we have to figure that we're running in Studio for now
pass
self.runtime.publish(self, 'drag-and-drop-v2.item.dropped', {
self.runtime.publish(self, 'xblock.drag-and-drop-v2.item.dropped', {
'component_id': self.scope_ids.usage_id,
'user_id': self.runtime.user_id,
'item_id': item['id'],
......
function DragAndDropBlock(runtime, element) {
function publish_event(data) {
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'publish_event'),
data: JSON.stringify(data)
});
}
var dragAndDrop = (function($) {
var _fn = {
......@@ -93,16 +101,8 @@ function DragAndDropBlock(runtime, element) {
target = $(event.currentTarget);
target.removeClass('within-dropzone fade');
function publish_event(data) {
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'publish_event'),
data: JSON.stringify(data)
});
}
var item_id = target.data("value");
publish_event({event_type:'drag-and-drop-v2.item.picked-up', item_id:item_id});
publish_event({event_type:'xblock.drag-and-drop-v2.item.pickedup', item_id:item_id});
},
stop: function(event, ui) {
......@@ -250,4 +250,8 @@ function DragAndDropBlock(runtime, element) {
}).done(function(data){
dragAndDrop.init(data);
});
publish_event({
event_type:"xblock.drag-and-drop-v2.loaded"
});
}
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