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

@ -123,7 +123,7 @@ GEM
ed25519 (1.2.4) ed25519 (1.2.4)
erubi (1.9.0) erubi (1.9.0)
eventmachine (1.0.9.1) eventmachine (1.0.9.1)
excon (0.71.1) excon (0.72.0)
execjs (2.7.0) execjs (2.7.0)
factory_bot (5.1.1) factory_bot (5.1.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -135,7 +135,7 @@ GEM
faye-websocket (0.10.9) faye-websocket (0.10.9)
eventmachine (>= 0.12.0) eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1) websocket-driver (>= 0.5.1)
ffi (1.11.3) ffi (1.12.1)
forgery (0.7.0) forgery (0.7.0)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -179,7 +179,7 @@ GEM
mime-types (3.3.1) mime-types (3.3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009) mime-types-data (3.2019.1009)
mimemagic (0.3.3) mimemagic (0.3.4)
mini_magick (4.10.1) mini_magick (4.10.1)
mini_mime (1.0.2) mini_mime (1.0.2)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
@ -204,7 +204,7 @@ GEM
nyan-cat-formatter (0.12.0) nyan-cat-formatter (0.12.0)
rspec (>= 2.99, >= 2.14.2, < 4) rspec (>= 2.99, >= 2.14.2, < 4)
oauth (0.5.4) oauth (0.5.4)
oauth2 (1.4.2) oauth2 (1.4.3)
faraday (>= 0.8, < 2.0) faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0) jwt (>= 1.0, < 3.0)
multi_json (~> 1.3) multi_json (~> 1.3)
@ -348,11 +348,10 @@ GEM
faraday (>= 0.7.6, < 1.0) faraday (>= 0.7.6, < 1.0)
shoulda-matchers (4.2.0) shoulda-matchers (4.2.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
simplecov (0.17.1) simplecov (0.18.0)
docile (~> 1.1) docile (~> 1.1)
json (>= 1.8, < 3) simplecov-html (~> 0.11.0)
simplecov-html (~> 0.10.0) simplecov-html (0.11.0)
simplecov-html (0.10.2)
slim (4.0.1) slim (4.0.1)
temple (>= 0.7.6, < 0.9) temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1) tilt (>= 2.0.6, < 2.1)
@ -387,7 +386,7 @@ GEM
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.6) unf_ext (0.0.7.6)
unicode-display_width (1.6.0) unicode-display_width (1.6.1)
web-console (3.7.0) web-console (3.7.0)
actionview (>= 5.0) actionview (>= 5.0)
activemodel (>= 5.0) activemodel (>= 5.0)

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 () { fileActionsAvailable: function () {
return this.isActiveFileRenderable() || this.isActiveFileRunnable() || this.isActiveFileStoppable() || this.isActiveFileTestable(); return this.isActiveFileRenderable() || this.isActiveFileRunnable() || this.isActiveFileStoppable() || this.isActiveFileTestable();
}, },
@ -361,6 +368,9 @@ configureEditors: function () {
$('#save').on('click', this.saveCode.bind(this)); $('#save').on('click', this.saveCode.bind(this));
$('#start-over').on('click', this.confirmReset.bind(this)); $('#start-over').on('click', this.confirmReset.bind(this));
$('#start-over-collapsed').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 () { initializeRequestForComments: function () {

View File

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

View File

@ -10,7 +10,10 @@
@import '~bootswatch/dist/yeti/variables'; @import '~bootswatch/dist/yeti/variables';
@import '~bootstrap/scss/bootstrap'; @import '~bootstrap/scss/bootstrap';
@import '~bootswatch/dist/yeti/bootswatch'; @import '~bootswatch/dist/yeti/bootswatch';
$fa-font-path: '~font-awesome/fonts'; $fa-font-path: '~@fortawesome/fontawesome-free/webfonts/';
@import '~font-awesome/scss/font-awesome'; @import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/solid';
@import '~@fortawesome/fontawesome-free/scss/regular';
@import '~@fortawesome/fontawesome-free/scss/v4-shims';
$opensans-path: '~opensans-webkit/fonts/'; $opensans-path: '~opensans-webkit/fonts/';
@import '~opensans-webkit/src/sass/open-sans'; @import '~opensans-webkit/src/sass/open-sans';

View File

@ -9,6 +9,7 @@ div id='sidebar-collapsed' class=(@exercise.hide_file_tree ? '' : 'd-none')
= render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise), :'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-history', id: 'start-over-collapsed', label:'', title: t('exercises.editor.start_over')) = render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise), :'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-history', id: 'start-over-collapsed', label:'', title: t('exercises.editor.start_over'))
//- if !@course_token.blank? //- if !@course_token.blank?
= render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-search', id: 'sidebar-search-collapsed', label: '', title: t('search.search_in_forum')) = render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-search', id: 'sidebar-search-collapsed', label: '', title: t('search.search_in_forum'))
= render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over_active_file'), :'data-url' => reload_exercise_path(@exercise), :'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-file-excel', id: 'start-over-active-file-collapsed', label: '', title: t('exercises.editor.start_over_active_file'))
div id='sidebar-uncollapsed' class=(@exercise.hide_file_tree ? 'd-none' : '') div id='sidebar-uncollapsed' class=(@exercise.hide_file_tree ? 'd-none' : '')
= render('editor_button', classes: 'btn-block btn-primary btn', icon: 'fa fa-minus-square', id: 'sidebar-collapse', label: t('exercises.editor.collapse_action_sidebar')) = render('editor_button', classes: 'btn-block btn-primary btn', icon: 'fa fa-minus-square', id: 'sidebar-collapse', label: t('exercises.editor.collapse_action_sidebar'))
@ -27,6 +28,7 @@ div id='sidebar-uncollapsed' class=(@exercise.hide_file_tree ? 'd-none' : '')
- unless @embed_options[:disable_download] - unless @embed_options[:disable_download]
= render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', icon: 'fa fa-download', id: 'download', label: t('exercises.editor.download')) = render('editor_button', classes: 'btn-block btn-primary btn enforce-top-margin', icon: 'fa fa-download', id: 'download', label: t('exercises.editor.download'))
= render('editor_button', classes: 'btn-block btn-primary btn', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over')) = render('editor_button', classes: 'btn-block btn-primary btn', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over'))
= render('editor_button', classes: 'btn-block btn-primary btn', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over_active_file'), :'data-url' => reload_exercise_path(@exercise)}, icon: 'fa fa-file-excel', id: 'start-over-active-file', label: t('exercises.editor.start_over_active_file'))
//- if !@course_token.blank? //- if !@course_token.blank?
.input-group.enforce-top-margin .input-group.enforce-top-margin

View File

@ -279,7 +279,8 @@ de:
editor: editor:
collapse_action_sidebar: Aktions-Leiste Einklappen collapse_action_sidebar: Aktions-Leiste Einklappen
collapse_output_sidebar: Ausgabe-Leiste Einklappen collapse_output_sidebar: Ausgabe-Leiste Einklappen
confirm_start_over: Wollen Sie wirklich von vorne anfangen? confirm_start_over: Wollen Sie wirklich von vorne anfangen? Ihr kompletter Fortschritt wird entfernt. Diese Aktion kann nicht rückgängig gemacht werden.
confirm_start_over_active_file: Wollen Sie wirklich den Inhalt dieser Datei löschen? Diese Aktion kann nicht rückgängig gemacht werden.
confirm_submit: Wollen Sie Ihren Code wirklich zur Bewertung abgeben? confirm_submit: Wollen Sie Ihren Code wirklich zur Bewertung abgeben?
create_file: Neue Datei create_file: Neue Datei
depleted: Alle Ausführungsausgebungen sind momentan in Benutzung. Probiere es später nochmal. depleted: Alle Ausführungsausgebungen sind momentan in Benutzung. Probiere es später nochmal.
@ -301,6 +302,7 @@ de:
score: Bewerten score: Bewerten
send: Senden send: Senden
start_over: Von vorne anfangen start_over: Von vorne anfangen
start_over_active_file: Diese Datei zurücksetzen
stop: Stoppen stop: Stoppen
submit: Code zur Bewertung abgeben submit: Code zur Bewertung abgeben
test: Testen test: Testen

View File

@ -279,7 +279,8 @@ en:
editor: editor:
collapse_action_sidebar: Collapse Action Sidebar collapse_action_sidebar: Collapse Action Sidebar
collapse_output_sidebar: Collapse Output Sidebar collapse_output_sidebar: Collapse Output Sidebar
confirm_start_over: Do you really want to start over? confirm_start_over: Do you really want to start over? Your complete progress will be reset. You cannot undo this action.
confirm_start_over_active_file: Do you really want to reset this file? You cannot undo this action.
confirm_submit: Do you really want to submit your code for grading? confirm_submit: Do you really want to submit your code for grading?
create_file: New File create_file: New File
depleted: All execution environments are busy. Please try again later. depleted: All execution environments are busy. Please try again later.
@ -301,6 +302,7 @@ en:
score: Score score: Score
send: Send send: Send
start_over: Start over start_over: Start over
start_over_active_file: Reset this file
stop: Stop stop: Stop
submit: Submit Code For Assessment submit: Submit Code For Assessment
test: Test test: Test

View File

@ -1,12 +1,12 @@
{ {
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.12.0",
"@rails/webpacker": "4.2", "@rails/webpacker": "4.2",
"bootstrap": "^4.1.3", "bootstrap": "^4.1.3",
"bootswatch": "^4.4.1", "bootswatch": "^4.4.1",
"chosen-js": "^1.8.7", "chosen-js": "^1.8.7",
"d3": "^5.15.0", "d3": "^5.15.0",
"d3-tip": "^0.9.1", "d3-tip": "^0.9.1",
"font-awesome": "^4.7.0",
"highlight.js": "^9.18.0", "highlight.js": "^9.18.0",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"jquery-ui": "^1.12.1", "jquery-ui": "^1.12.1",

1392
yarn.lock

File diff suppressed because it is too large Load Diff