From 972b63c03e4e8cdf2ce6d076f9c62a57af3a8af4 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 10 Mar 2016 14:52:59 +0100 Subject: [PATCH 1/2] Test sending LA events to openhpi --- app/assets/javascripts/editor.js.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/editor.js.erb b/app/assets/javascripts/editor.js.erb index 4164eb80..ebf9d4da 100644 --- a/app/assets/javascripts/editor.js.erb +++ b/app/assets/javascripts/editor.js.erb @@ -310,14 +310,14 @@ $(function() { //console.log("Text is the same: " + same); // if the text is not copied from within the editor (from any file), send an event to lanalytics - //if(!same){ - // publishCodeOceanEvent("codeocean_editor_paste", { - // text: pasteObject.text, - // exercise: $('#editor').data('exercise-id'), - // file_id: "1" - // - // }); - //} + if(!same){ + publishCodeOceanEvent("codeocean_editor_paste", { + text: pasteObject.text, + exercise: $('#editor').data('exercise-id'), + file_id: "1" + + }); + } }; var handleScoringResponse = function(response) { From 757efeaf0202fcda12490a5628b58597ec773d00 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 10 Mar 2016 14:58:50 +0100 Subject: [PATCH 2/2] minor UI changes, removed elements not needed, replaced text-area for description with an ace editor. --- app/assets/javascripts/exercises.js | 5 ++++- app/views/exercises/_form.html.slim | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/exercises.js b/app/assets/javascripts/exercises.js index b236e75e..1f861ef6 100644 --- a/app/assets/javascripts/exercises.js +++ b/app/assets/javascripts/exercises.js @@ -154,7 +154,10 @@ $(function() { } else if ($('.edit_exercise, .new_exercise').isPresent()) { execution_environments = $('form').data('execution-environments'); file_types = $('form').data('file-types'); - new MarkdownEditor('#exercise_instructions'); + // new MarkdownEditor('#exercise_instructions'); + new MarkdownEditor('#exercise_description'); + // todo: add an ace editor for each file + enableInlineFileCreation(); inferFileAttributes(); observeFileRoleChanges(); diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index 1002f78a..c4d312cc 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -8,15 +8,16 @@ = f.text_field(:title, class: 'form-control', required: true) .form-group = f.label(:description) - = f.text_area(:description, class: 'form-control') + = f.hidden_field(:description) + .form-control.markdown .form-group = f.label(:execution_environment_id) = f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {}, class: 'form-control') - .form-group + /.form-group = f.label(:instructions) = f.hidden_field(:instructions) .form-control.markdown - .form-group + /.form-group = f.label(:team_id) = f.collection_select(:team_id, @teams, :id, :name, {include_blank: true}, class: 'form-control') .checkbox