Commit a4fe83d0 by dragonfi

Publish feedback closed event

parent 053f9d61
......@@ -147,6 +147,20 @@ class MentoringBlock(XBlockWithLightChildren):
return fragment
@XBlock.json_handler
def publish_event(self, data, suffix=''):
try:
event_type = data.pop('event_type')
except KeyError as e:
return {'result': 'error', 'message': 'Missing event_type in JSON data'}
data['component_id'] = self.scope_ids.usage_id
data['user_id'] = self.runtime.user_id
self.runtime.publish(self, event_type, data)
return {'result':'success'}
@property
def title(self):
"""
......
......@@ -27,9 +27,16 @@ function MessageView(element) {
popupDOM.css('height', '')
}
popupDOM.show();
$('.close', popupDOM).on('click', function() {
self.clearPopupEvents();
console.log(popupDOM);
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'publish_event'),
data: JSON.stringify({event_type:'mentoring.feedback.closed'})
});
});
},
showMessage: function(message) {
......
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