Commit 475ad034 by dragonfi

PR comments: Rename events

parent a4fe83d0
...@@ -141,10 +141,6 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -141,10 +141,6 @@ class MentoringBlock(XBlockWithLightChildren):
fragment.initialize_js('MentoringBlock') fragment.initialize_js('MentoringBlock')
self.runtime.publish(self, 'mentoring.problem.shown',
{'component_id': self.scope_ids.usage_id, 'user_id': self.runtime.user_id}
)
return fragment return fragment
@XBlock.json_handler @XBlock.json_handler
...@@ -247,7 +243,7 @@ class MentoringBlock(XBlockWithLightChildren): ...@@ -247,7 +243,7 @@ class MentoringBlock(XBlockWithLightChildren):
raw_score = self.score[0] raw_score = self.score[0]
self.runtime.publish(self, 'mentoring.problem.attempted', { self.runtime.publish(self, 'xblock.mentoring.submitted', {
'component_id': self.scope_ids.usage_id, 'component_id': self.scope_ids.usage_id,
'user_id': self.runtime.user_id, 'user_id': self.runtime.user_id,
'num_attempts': self.num_attempts, 'num_attempts': self.num_attempts,
......
...@@ -92,4 +92,10 @@ function MentoringBlock(runtime, element) { ...@@ -92,4 +92,10 @@ function MentoringBlock(runtime, element) {
else if (data.mode === 'assessment') { else if (data.mode === 'assessment') {
MentoringAssessmentView(runtime, element, mentoring); MentoringAssessmentView(runtime, element, mentoring);
} }
$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'publish_event'),
data: JSON.stringify({event_type:"xblock.mentoring.loaded"})
});
} }
...@@ -27,16 +27,22 @@ function MessageView(element) { ...@@ -27,16 +27,22 @@ function MessageView(element) {
popupDOM.css('height', '') popupDOM.css('height', '')
} }
popupDOM.show(); popupDOM.show();
$('.close', popupDOM).on('click', function() {
self.clearPopupEvents(); function publish_event(data) {
console.log(popupDOM);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: runtime.handlerUrl(element, 'publish_event'), url: runtime.handlerUrl(element, 'publish_event'),
data: JSON.stringify({event_type:'mentoring.feedback.closed'}) data: JSON.stringify(data)
}); });
}
publish_event({event_type:'xblock.mentoring.feedback.opened'});
$('.close', popupDOM).on('click', function() {
self.clearPopupEvents();
console.log(popupDOM);
publish_event({event_type:'xblock.mentoring.feedback.closed'});
}); });
}, },
showMessage: function(message) { 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