<% end %>
@@ -66,22 +81,46 @@ also, all settings from the rails model needed for the editor configuration in t
var solvedButton = $('#mark-as-solved-button');
var commentOnExerciseButton = $('#comment-exercise-button');
- var addCommentExerciseButton = $('#addCommentExerciseButton')
+ var addCommentExerciseButton = $('#addCommentExerciseButton');
- solvedButton.on('click', function(event){
- var jqrequest = $.ajax({
+ var thankYouContainer = $('#thank-you-container');
+
+ solvedButton.on('click', function(){
+ $.ajax({
dataType: 'json',
method: 'GET',
url: location + '/mark_as_solved'
- });
-
- jqrequest.done(function(response){
+ }).done(function(response){
if(response.solved){
- solvedButton.hide();
+ solvedButton.removeClass('btn-primary');
+ solvedButton.addClass('btn-success');
+ solvedButton.html('<%= t('request_for_comments.solved') %>');
+ solvedButton.off('click');
+ thankYouContainer.show();
}
});
});
+ $('#send-thank-you-note').on('click', function () {
+ var value = $('#thank-you-note').val();
+ if (value) {
+ $.ajax({
+ dataType: 'json',
+ method: 'POST',
+ url: location + '/set_thank_you_note',
+ data: {
+ note: value
+ }
+ }).done(function() {
+ thankYouContainer.hide();
+ });
+ }
+ });
+
+ $('#cancel-thank-you-note').on('click', function () {
+ thankYouContainer.hide();
+ });
+
// set file paths for ace
var ACE_FILES_PATH = '/assets/ace/';
_.each(['modePath', 'themePath', 'workerPath'], function(attribute) {
@@ -89,7 +128,6 @@ also, all settings from the rails model needed for the editor configuration in t
});
var commentitor = $('.editor');
- var userid = commentitor.data('user-id');
commentitor.each(function (index, editor) {
var currentEditor = ace.edit(editor);
@@ -203,9 +241,6 @@ also, all settings from the rails model needed for the editor configuration in t
var editor = e.editor;
if (target.className.indexOf("ace_gutter-cell") == -1) return;
- //if (!editor.isFocused()) return;
- //if (e.clientX > 25 + target.getBoundingClientRect().left) return;
-
var row = e.getDocumentPosition().row;
e.stop();
@@ -250,12 +285,12 @@ also, all settings from the rails model needed for the editor configuration in t
$.flash.danger({
text: message.length > 0 ? message : $('#flash').data('message-failure')
});
- };
+ }
function stringDivider(str, width, spaceReplacer) {
if (str.length>width) {
- var p=width
+ var p=width;
for (;p>0 && str[p]!=' ';p--) {
}
if (p>0) {
diff --git a/app/views/user_mailer/send_thank_you_note.slim b/app/views/user_mailer/send_thank_you_note.slim
new file mode 100644
index 00000000..fcdcdf8d
--- /dev/null
+++ b/app/views/user_mailer/send_thank_you_note.slim
@@ -0,0 +1 @@
+== t('mailers.user_mailer.send_thank_you_note.body', receiver_displayname: @receiver_displayname, link_to_comment: link_to(@rfc_link, @rfc_link), author: @author, thank_you_note: @thank_you_note )
diff --git a/config/locales/de.yml b/config/locales/de.yml
index a5bcf381..d0aef588 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -410,6 +410,41 @@ de:
reset_password:
body: 'Bitte besuchen Sie %{link}, sofern Sie Ihr Passwort zurücksetzen wollen.'
subject: Anweisungen zum Zurücksetzen Ihres Passworts
+ send_thank_you_note:
+ body: |
+ English version below
+ _________________________
+
+ Hallo %{receiver_displayname},
+
+ %{author} hat Ihnen für Ihren Kommentar auf CodeOcean gedankt.
+
+ %{author} schreibt: %{thank_you_note}
+
+ Sie finden die Kommentaranfrage hier: %{link_to_comment}
+
+ Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.
+
+ Danke, dass Sie anderen Nutzern von CodeOcean helfen!
+
+ Diese Mail wurde automatisch von CodeOcean verschickt.
+
+ _________________________
+
+ Dear %{receiver_displayname},
+
+ %{author} thanks you for your comment.
+
+ %{author} wrote: %{thank_you_note}
+
+ You can find the request for comments here: %{link_to_comment}
+
+ If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again.
+
+ Thank you for helping other users on CodeOcean!
+
+ This mail was automatically sent by CodeOcean.
+ subject: "%{author} sagt danke!"
request_for_comments:
click_here: Zum Kommentieren auf die Seitenleiste klicken!
comments: Kommentare
@@ -428,6 +463,9 @@ de:
show_unsolved: "Nur ungelöste Anfragen anzeigen"
solved: "Diese Frage wurde erfolgreich beantwortet"
comment_exercise: "Ich möchte die Aufgabenstellung kommentieren"
+ write_a_thank_you_node: "Wenn Sie möchten, können Sie sich bei allen Mitstudenten, die Ihnen bei der Beantwortung Ihrer Frage geholfen haben, bedanken:"
+ send_thank_you_note: "Senden"
+ cancel_thank_you_note: "Nichts senden"
sessions:
create:
failure: Fehlerhafte E-Mail oder Passwort.
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e5077e4e..9a334697 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -431,6 +431,41 @@ en:
reset_password:
body: 'Please visit %{link} if you want to reset your password.'
subject: Password reset instructions
+ send_thank_you_note:
+ body: |
+ English version below
+ _________________________
+
+ Hallo %{receiver_displayname},
+
+ %{author} hat Ihnen für Ihren Kommentar auf CodeOcean gedankt.
+
+ %{author} schreibt: %{thank_you_note}
+
+ Sie finden die Kommentaranfrage hier: %{link_to_comment}
+
+ Falls Sie beim Klick auf diesen Link eine Fehlermeldung erhalten, dass Sie nicht berechtigt wären diese Aktion auszuführen, öffnen Sie bitte eine beliebige Programmieraufgabe aus einem Kurs heraus und klicken den Link danach noch einmal.
+
+ Danke, dass Sie anderen Nutzern von CodeOcean helfen!
+
+ Diese Mail wurde automatisch von CodeOcean verschickt.
+
+ _________________________
+
+ Dear %{receiver_displayname},
+
+ %{author} thanks you for your comment.
+
+ %{author} wrote: %{thank_you_note}
+
+ You can find the request for comments here: %{link_to_comment}
+
+ If you receive an error that you are not authorized to perform this action when clicking the link, please log-in through any course exercise beforehand and click the link again.
+
+ Thank you for helping other users on CodeOcean!
+
+ This mail was automatically sent by CodeOcean.
+ subject: "%{author} says thank you!"
request_for_comments:
click_here: Click on this sidebar to comment!
comments: Comments
@@ -449,6 +484,9 @@ en:
show_unsolved: "Unvsolved requests"
solved: "This question has been answered"
comment_exercise: "I would like to give feedback for this exercise"
+ write_a_thank_you_node: "If you want, you can write a thank you note to all your commenters:"
+ send_thank_you_note: "Send"
+ cancel_thank_you_note: "Don't send"
sessions:
create:
failure: Invalid email or password.
diff --git a/config/routes.rb b/config/routes.rb
index fc0f9406..d340a204 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -11,6 +11,7 @@ Rails.application.routes.draw do
member do
get :mark_as_solved
post :create_comment_exercise
+ post :set_thank_you_note
end
end
resources :comments, except: [:destroy] do
diff --git a/db/migrate/20170608141612_add_thank_you_note_to_request_for_comments.rb b/db/migrate/20170608141612_add_thank_you_note_to_request_for_comments.rb
new file mode 100644
index 00000000..fb767aad
--- /dev/null
+++ b/db/migrate/20170608141612_add_thank_you_note_to_request_for_comments.rb
@@ -0,0 +1,5 @@
+class AddThankYouNoteToRequestForComments < ActiveRecord::Migration
+ def change
+ add_column :request_for_comments, :thank_you_note, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f0ecde99..81693c1d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170403162848) do
+ActiveRecord::Schema.define(version: 20170608141612) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -93,7 +93,7 @@ ActiveRecord::Schema.define(version: 20170403162848) do
create_table "exercise_tags", force: :cascade do |t|
t.integer "exercise_id"
t.integer "tag_id"
- t.integer "factor", default: 0
+ t.integer "factor", default: 1
end
create_table "exercises", force: :cascade do |t|
@@ -110,7 +110,7 @@ ActiveRecord::Schema.define(version: 20170403162848) do
t.boolean "hide_file_tree"
t.boolean "allow_file_creation"
t.boolean "allow_auto_completion", default: false
- t.integer "expected_worktime_seconds", default: 0
+ t.integer "expected_worktime_seconds", default: 60
t.integer "expected_difficulty", default: 1
end
@@ -247,15 +247,16 @@ ActiveRecord::Schema.define(version: 20170403162848) do
end
create_table "request_for_comments", force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "exercise_id", null: false
- t.integer "file_id", null: false
+ t.integer "user_id", null: false
+ t.integer "exercise_id", null: false
+ t.integer "file_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.string "user_type", limit: 255
+ t.string "user_type", limit: 255
t.text "question"
- t.boolean "solved", default: false
+ t.boolean "solved", default: false
t.integer "submission_id"
+ t.text "thank_you_note"
end
create_table "searches", force: :cascade do |t|
@@ -296,12 +297,13 @@ ActiveRecord::Schema.define(version: 20170403162848) do
end
create_table "user_exercise_feedbacks", force: :cascade do |t|
- t.integer "exercise_id", null: false
- t.integer "user_id", null: false
- t.string "user_type", null: false
+ t.integer "exercise_id", null: false
+ t.integer "user_id", null: false
+ t.string "user_type", null: false
t.integer "difficulty"
t.integer "working_time_seconds"
t.string "feedback_text"
+ t.integer "user_estimated_worktime"
end
create_table "user_exercise_interventions", force: :cascade do |t|
@@ -309,6 +311,8 @@ ActiveRecord::Schema.define(version: 20170403162848) do
t.string "user_type"
t.integer "exercise_id"
t.integer "intervention_id"
+ t.integer "accumulated_worktime_s"
+ t.text "reason"
t.datetime "created_at"
t.datetime "updated_at"
end