Fix request for comments. Scope of the function call was incorrect, and the correct cause was not passed to the rails and the database afterwards. This is both fixed now.

This commit is contained in:
Ralf Teusner
2016-12-02 15:25:54 +01:00
parent 66de024195
commit 5b00f41c10
3 changed files with 5 additions and 3 deletions

View File

@ -319,7 +319,7 @@ configureEditors: function () {
$('#comment-modal').modal('show');
});
$('#askForCommentsButton').on('click', this.requestComments);
$('#askForCommentsButton').on('click', this.requestComments.bind(this));
setTimeout(function () {
button.prop('disabled', false);

View File

@ -84,7 +84,7 @@ CodeOceanEditorRequestForComments = {
}.bind(this)).error(this.ajaxError.bind(this));
};
this.createSubmission($('.requestCommentsButton'), null, createRequestForComments.bind(this));
this.createSubmission($('#requestComments'), null, createRequestForComments.bind(this));
$('#comment-modal').modal('hide');
var button = $('#requestComments');

View File

@ -1,4 +1,6 @@
h5 = t('exercises.implement.comment.question')
textarea.form-control#question(style='resize:none;')
p = ''
button#askForCommentsButton.btn.btn-block.btn-primary(type='button' data-message-success=t('exercises.editor.request_for_comments_sent')) =t('exercises.implement.comment.request')
/ data-cause='requestComments' is not used here right now, we pass the button #requestComments (not askForCommentsButton) as initiator of the action.
/ But if we use this button, it will work since the correct cause is supplied
button#askForCommentsButton.btn.btn-block.btn-primary(type='button' data-cause='requestComments' data-message-success=t('exercises.editor.request_for_comments_sent')) =t('exercises.implement.comment.request')