Remove unnecessary code from editor

This commit is contained in:
Maximilian Grundke
2016-04-30 13:26:01 +02:00
parent bd4fbcb8fb
commit e4246029da

View File

@ -256,8 +256,6 @@ $(function() {
} }
}; };
var getPanelClass = function(result) { var getPanelClass = function(result) {
if (result.stderr && !result.score) { if (result.stderr && !result.score) {
return 'panel-danger'; return 'panel-danger';
@ -446,66 +444,6 @@ $(function() {
}); });
}; };
var setAnnotations = function (editor, file_id){
var session = editor.getSession();
var url = "/comments";
var jqrequest = $.ajax({
dataType: 'json',
method: 'GET',
url: url,
data: {
file_id: file_id
}
});
jqrequest.done(function(response){
setAnnotationsCallback(response, session);
});
jqrequest.fail(ajaxError);
};
var setAnnotationsCallback = function (response, session) {
var annotations = response;
// add classname and the username in front of each comment
$.each(annotations, function(index, comment){
comment.className = "code-ocean_comment";
comment.text = comment.username + ": " + comment.text;
});
session.setAnnotations(annotations);
};
var handleAnnotationRemoval = function(removedAnnotations) {
removedAnnotations.forEach(function(annotation) {
$.ajax({
method: 'DELETE',
url: '/comment_by_id',
data: {
id: annotation.id,
}
})
})
};
var handleAnnotationChange = function(changedAnnotations) {
changedAnnotations.forEach(function(annotation) {
$.ajax({
method: 'PUT',
url: '/comments',
data: {
id: annotation.id,
user_id: $('#editor').data('user-id'),
comment: {
row: annotation.row,
text: annotation.text
}
}
})
})
};
var initializeEventHandlers = function() { var initializeEventHandlers = function() {
$(document).on('click', '#results a', showOutput); $(document).on('click', '#results a', showOutput);
$(document).on('keypress', handleKeyPress); $(document).on('keypress', handleKeyPress);