diff --git a/app/assets/javascripts/editor/participantsupport.js.erb b/app/assets/javascripts/editor/participantsupport.js.erb
index 5e6fd4a4..eb02176e 100644
--- a/app/assets/javascripts/editor/participantsupport.js.erb
+++ b/app/assets/javascripts/editor/participantsupport.js.erb
@@ -67,6 +67,16 @@ CodeOceanEditorFlowr = {
}
return results;
},
+ createEventHandler: function (eventType, data) {
+ return function () {
+ CodeOceanEditor.publishCodeOceanEvent({
+ category: eventType,
+ data: data,
+ exercise_id: $('#editor').data('exercise-id'),
+ file_id: null
+ });
+ };
+ },
handleStderrOutputForFlowr: function () {
if (! this.isFlowrEnabled) return;
@@ -80,9 +90,16 @@ CodeOceanEditorFlowr = {
var collapsibleTileHtml = self.flowrResultHtml.replace(/{{collapseId}}/g, 'collapse-' + index).replace(/{{headingId}}/g, 'heading-' + index);
var resultTile = $(collapsibleTileHtml);
- resultTile.find('h4 > a').text(result.title);
- resultTile.find('.panel-body').html(result.body);
- resultTile.find('.panel-body').append('Open this question');
+ var questionUrl = 'https://stackoverflow.com/questions/' + result.question_id;
+
+ var header = resultTile.find('h4 > a');
+ header.text(result.title);
+ header.on('click', self.createEventHandler('editor_flowr_expand_question', questionUrl));
+
+ var body = resultTile.find('.panel-body');
+ body.html(result.body);
+ body.append('Open this question');
+ body.find('.btn').on('click', self.createEventHandler('editor_flowr_click_question', questionUrl));
flowrHintBody.append(resultTile);
});