Upgrade font-awesome and add option reset only active file

This commit is contained in:
Sebastian Serth
2020-01-29 10:55:15 +01:00
parent 286f0b9d3c
commit d0eceac440
9 changed files with 787 additions and 655 deletions

View File

@@ -57,6 +57,13 @@ configureEditors: function () {
}
},
confirmResetActiveFile: function (event) {
event.preventDefault();
if (confirm($('#start-over-active-file').data('message-confirm'))) {
this.resetCode(true); // delete only active file
}
},
fileActionsAvailable: function () {
return this.isActiveFileRenderable() || this.isActiveFileRunnable() || this.isActiveFileStoppable() || this.isActiveFileTestable();
},
@@ -361,6 +368,9 @@ configureEditors: function () {
$('#save').on('click', this.saveCode.bind(this));
$('#start-over').on('click', this.confirmReset.bind(this));
$('#start-over-collapsed').on('click', this.confirmReset.bind(this));
$('#start-over-active-file').on('click', this.confirmResetActiveFile.bind(this));
$('#start-over-active-file-collapsed').on('click', this.confirmResetActiveFile.bind(this));
},
initializeRequestForComments: function () {

View File

@@ -102,7 +102,7 @@ CodeOceanEditorSubmissions = {
});
},
resetCode: function() {
resetCode: function(onlyActiveFile = false) {
this.showSpinner(this);
this.ajax({
method: 'GET',
@@ -114,7 +114,7 @@ CodeOceanEditorSubmissions = {
var file = _.find(response.files, function(file) {
return file.id === file_id;
});
if(file){
if(file && !onlyActiveFile || file && file.id === CodeOceanEditor.active_file.id){
editor.setValue(file.content);
}
}.bind(this));