Remove more code; handle click event
This commit is contained in:
@@ -110,18 +110,6 @@ $(function() {
|
|||||||
|
|
||||||
var createSubmission = function(initiator, filter, callback) {
|
var createSubmission = function(initiator, filter, callback) {
|
||||||
showSpinner(initiator);
|
showSpinner(initiator);
|
||||||
|
|
||||||
var annotations_arr = [];
|
|
||||||
|
|
||||||
$('.editor').each(function(index, element) {
|
|
||||||
var editor = ace.edit(element);
|
|
||||||
var cleaned_annotations = editor.getSession().getAnnotations();
|
|
||||||
for(var i = cleaned_annotations.length-1; i>=0; --i){
|
|
||||||
cleaned_annotations[i].text = cleaned_annotations[i].text.replace(cleaned_annotations[i].username + ": ", "");
|
|
||||||
}
|
|
||||||
annotations_arr = annotations_arr.concat(editor.getSession().getAnnotations());
|
|
||||||
});
|
|
||||||
|
|
||||||
var jqxhr = ajax({
|
var jqxhr = ajax({
|
||||||
data: {
|
data: {
|
||||||
submission: {
|
submission: {
|
||||||
@@ -129,7 +117,7 @@ $(function() {
|
|||||||
exercise_id: $('#editor').data('exercise-id'),
|
exercise_id: $('#editor').data('exercise-id'),
|
||||||
files_attributes: (filter || _.identity)(collectFiles())
|
files_attributes: (filter || _.identity)(collectFiles())
|
||||||
},
|
},
|
||||||
annotations_arr: annotations_arr
|
annotations_arr: []
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -169,7 +157,6 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setAnnotations(editors[i], $(editors[i].container).data('id'));
|
|
||||||
}
|
}
|
||||||
// toggle button states (it might be the case that the request for comments button has to be enabled
|
// toggle button states (it might be the case that the request for comments button has to be enabled
|
||||||
toggleButtonStates();
|
toggleButtonStates();
|
||||||
@@ -423,7 +410,6 @@ $(function() {
|
|||||||
session.setUseWrapMode(true);
|
session.setUseWrapMode(true);
|
||||||
|
|
||||||
var file_id = $(element).data('id');
|
var file_id = $(element).data('id');
|
||||||
//setAnnotations(editor, file_id);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register event handlers
|
* Register event handlers
|
||||||
@@ -433,10 +419,6 @@ $(function() {
|
|||||||
editor.on("paste", handlePasteEvent);
|
editor.on("paste", handlePasteEvent);
|
||||||
editor.on("copy", handleCopyEvent);
|
editor.on("copy", handleCopyEvent);
|
||||||
|
|
||||||
//session
|
|
||||||
session.on('annotationRemoval', handleAnnotationRemoval);
|
|
||||||
session.on('annotationChange', handleAnnotationChange);
|
|
||||||
|
|
||||||
// listener for autosave
|
// listener for autosave
|
||||||
session.on("change", function (deltaObject) {
|
session.on("change", function (deltaObject) {
|
||||||
resetSaveTimer();
|
resetSaveTimer();
|
||||||
@@ -451,6 +433,7 @@ $(function() {
|
|||||||
initializeFileTreeButtons();
|
initializeFileTreeButtons();
|
||||||
initializeWorkflowButtons();
|
initializeWorkflowButtons();
|
||||||
initializeWorkspaceButtons();
|
initializeWorkspaceButtons();
|
||||||
|
initializeRequestForComments()
|
||||||
};
|
};
|
||||||
|
|
||||||
var initializeFileTree = function() {
|
var initializeFileTree = function() {
|
||||||
@@ -493,6 +476,12 @@ $(function() {
|
|||||||
$('#start-over').on('click', confirmReset);
|
$('#start-over').on('click', confirmReset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var initializeRequestForComments = function () {
|
||||||
|
$('#requestCommentsButton').on('click', function() {
|
||||||
|
$('#comment-modal').modal('show');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var isActiveFileBinary = function() {
|
var isActiveFileBinary = function() {
|
||||||
return 'binary' in active_frame.data();
|
return 'binary' in active_frame.data();
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user