diff --git a/app/assets/javascripts/editor/evaluation.js b/app/assets/javascripts/editor/evaluation.js index 23e18bf0..79bd52a8 100644 --- a/app/assets/javascripts/editor/evaluation.js +++ b/app/assets/javascripts/editor/evaluation.js @@ -164,12 +164,10 @@ CodeOceanEditorEvaluation = { } else if (output.stderr) { //element.addClass('text-warning').append(output.stderr); element.addClass('text-warning').text(element.text() + output.stderr); - this.flowrOutputBuffer += output.stderr; this.QaApiOutputBuffer.stderr += output.stderr; } else if (output.stdout) { //element.addClass('text-success').append(output.stdout); element.addClass('text-success').text(element.text() + output.stdout); - this.flowrOutputBuffer += output.stdout; this.QaApiOutputBuffer.stdout += output.stdout; } else { element.addClass('text-muted').text($('#output').data('message-no-output')); diff --git a/app/assets/javascripts/editor/participantsupport.js b/app/assets/javascripts/editor/participantsupport.js deleted file mode 100644 index 479b09c9..00000000 --- a/app/assets/javascripts/editor/participantsupport.js +++ /dev/null @@ -1,96 +0,0 @@ -CodeOceanEditorFlowr = { - isFlowrEnabled: true, - flowrResultHtml: '
', - - handleStderrOutputForFlowr: function () { - if (!this.isFlowrEnabled) return; - - var flowrUrl = $('#flowrHint').data('url'); - var flowrHintBody = $('#flowrHint .card-body'); - var queryParameters = { - query: this.flowrOutputBuffer - }; - - flowrHintBody.empty(); - - jQuery.getJSON(flowrUrl, queryParameters, function (data) { - jQuery.each(data.queryResults, function (index, question) { - var collapsibleTileHtml = this.flowrResultHtml.replace(/{{collapseId}}/g, 'collapse-' + question).replace(/{{headingId}}/g, 'heading-' + question); - var resultTile = $(collapsibleTileHtml); - - resultTile.find('h4 > a').text(question.title + ' | Found via ' + question.source); - resultTile.find('.card-body').html(question.body); - resultTile.find('.card-body').append('Open this question'); - - flowrHintBody.append(resultTile); - }); - - if (data.queryResults.length !== 0) { - $('#flowrHint').fadeIn(); - } - }); - - this.flowrOutputBuffer = ''; - } -}; - -CodeOceanEditorCodePilot = { - qa_api: undefined, - QaApiOutputBuffer: {'stdout': '', 'stderr': ''}, - - initializeCodePilot: function () { - if ($('#questions-column').isPresent() && (typeof QaApi != 'undefined') && QaApi.isBrowserSupported()) { - $('#editor-column').addClass('col-md-10').removeClass('col-md-12'); - $('#questions-column').addClass('col-md-2'); - - var node = document.getElementById('questions-holder'); - var url = $('#questions-holder').data('url'); - - this.qa_api = new QaApi(node, url); - } - }, - - handleQaApiOutput: function () { - if (this.qa_api) { - this.qa_api.executeCommand('syncOutput', [[this.QaApiOutputBuffer]]); - // reset the object - } - this.QaApiOutputBuffer = {'stdout': '', 'stderr': ''}; - } -}; - -CodeOceanEditorRequestForComments = { - requestComments: function () { - var user_id = $('#editor').data('user-id'); - var exercise_id = $('#editor').data('exercise-id'); - var file_id = $('.editor').data('id'); - var question = $('#question').val(); - - var createRequestForComments = function (submission) { - $.ajax({ - method: 'POST', - url: '/request_for_comments', - data: { - request_for_comment: { - exercise_id: exercise_id, - file_id: file_id, - submission_id: submission.id, - question: question - } - } - }).done(function () { - this.hideSpinner(); - $.flash.success({text: $('#askForCommentsButton').data('message-success')}); - // trigger a run - this.runSubmission.call(this, submission); - }.bind(this)).fail(this.ajaxError.bind(this)); - }; - - this.createSubmission($('#requestComments'), null, createRequestForComments.bind(this)); - - $('#comment-modal').modal('hide'); - // we disabled the button to prevent that the user spams RFCs, but decided against this now. - //var button = $('#requestComments'); - //button.prop('disabled', true); - }, -}; \ No newline at end of file diff --git a/app/assets/javascripts/editor/participantsupport.js.erb b/app/assets/javascripts/editor/participantsupport.js.erb new file mode 100644 index 00000000..9a8e54f8 --- /dev/null +++ b/app/assets/javascripts/editor/participantsupport.js.erb @@ -0,0 +1,179 @@ +CodeOceanEditorFlowr = { + isFlowrEnabled: <%= CodeOcean::Config.new(:code_ocean).read[:flowr][:enabled] %>, + flowrResultHtml: + '
' + + '