diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js
index 62e3872c..bd16653f 100644
--- a/app/assets/javascripts/editor.js
+++ b/app/assets/javascripts/editor.js
@@ -330,6 +330,10 @@ $(function() {
return isActiveFileExecutable() && ['teacher_defined_test', 'user_defined_test'].includes(active_frame.data('role'));
};
+ var isBrowserSupported = function() {
+ return window.EventSource !== undefined;
+ };
+
var populatePanel = function(panel, result, index) {
panel.removeClass('panel-default').addClass(getPanelClass(result));
panel.find('.panel-title .filename').text(result.filename);
@@ -631,13 +635,18 @@ $(function() {
};
if ($('#editor').isPresent()) {
- configureEditors();
- initializeEditors();
- initializeEventHandlers();
- initializeFileTree();
- initializeTooltips();
- renderScore();
- showFirstFile();
- showRequestedTab();
+ if (isBrowserSupported()) {
+ $('.score, #development-environment').show();
+ configureEditors();
+ initializeEditors();
+ initializeEventHandlers();
+ initializeFileTree();
+ initializeTooltips();
+ renderScore();
+ showFirstFile();
+ showRequestedTab();
+ } else {
+ $('#alert').show();
+ }
}
});
diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss
index 6f5564e3..a713234a 100644
--- a/app/assets/stylesheets/editor.css.scss
+++ b/app/assets/stylesheets/editor.css.scss
@@ -16,6 +16,14 @@ button i.fa-spin {
}
}
+.score {
+ display: none;
+}
+
+#alert, #development-environment {
+ display: none;
+}
+
#editor-buttons {
background-color: #008CBA;
margin-top: 1em;
diff --git a/app/views/exercises/implement.html.slim b/app/views/exercises/implement.html.slim
index 0ee7fa22..ea14acdb 100644
--- a/app/views/exercises/implement.html.slim
+++ b/app/views/exercises/implement.html.slim
@@ -4,65 +4,70 @@ span.badge.pull-right.score
p.lead = @exercise.description
-ul.nav.nav-justified.nav-tabs role='tablist'
- li.active
- a data-placement='top' data-toggle='tab' data-tooltip=true href='#instructions' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 1')
- i.fa.fa-question
- = t('activerecord.attributes.exercise.instructions')
- li
- a data-placement='top' data-toggle='tab' data-tooltip=true href='#workspace' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 2')
- i.fa.fa-code
- = t('.workspace')
- li
- a data-placement='top' data-toggle='tab' data-tooltip=true href='#outputInformation' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 3')
- i.fa.fa-terminal
- = t('.output')
- li
- a data-placement='top' data-toggle='tab' data-tooltip=true href='#progress' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 4')
- i.fa.fa-line-chart
- = t('.progress')
+#alert.alert.alert-danger role='alert'
+ h4 = t('.alert.title')
+ p = t('.alert.text', application_name: application_name)
-hr
-
-.tab-content
- #instructions.tab-pane.active
- p = render_markdown(@exercise.instructions)
- br
- p.text-center
- a#start.btn.btn-lg.btn-success
+#development-environment
+ ul.nav.nav-justified.nav-tabs role='tablist'
+ li.active
+ a data-placement='top' data-toggle='tab' data-tooltip=true href='#instructions' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 1')
+ i.fa.fa-question
+ = t('activerecord.attributes.exercise.instructions')
+ li
+ a data-placement='top' data-toggle='tab' data-tooltip=true href='#workspace' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 2')
i.fa.fa-code
- = t('.start')
- #workspace.tab-pane = render('editor', exercise: @exercise, files: @files, submission: @submission)
- #outputInformation.tab-pane data-message-no-output=t('.no_output')
- #hint
- .panel.panel-warning
- .panel-heading = t('.hint')
- .panel-body
- #output
- pre = t('.no_output_yet')
- - if CodeOcean::Config.new(:code_ocean).read[:flowr][:enabled]
- #flowrHint.panel.panel-info data-url=CodeOcean::Config.new(:code_ocean).read[:flowr][:url] role='tab'
- .panel-heading = 'Gain more insights here'
- .panel-body
- #progress.tab-pane
- #results
- h2 = t('.results')
- p.test-count == t('.test_count', count: 0)
- ul.list-unstyled
- ul#dummies.hidden.list-unstyled
- li.panel.panel-default
- .panel-heading
- h3.panel-title == t('.file', filename: '', number: 0)
+ = t('.workspace')
+ li
+ a data-placement='top' data-toggle='tab' data-tooltip=true href='#outputInformation' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 3')
+ i.fa.fa-terminal
+ = t('.output')
+ li
+ a data-placement='top' data-toggle='tab' data-tooltip=true href='#progress' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 4')
+ i.fa.fa-line-chart
+ = t('.progress')
+
+ hr
+
+ .tab-content
+ #instructions.tab-pane.active
+ p = render_markdown(@exercise.instructions)
+ br
+ p.text-center
+ a#start.btn.btn-lg.btn-success
+ i.fa.fa-code
+ = t('.start')
+ #workspace.tab-pane = render('editor', exercise: @exercise, files: @files, submission: @submission)
+ #outputInformation.tab-pane data-message-no-output=t('.no_output')
+ #hint
+ .panel.panel-warning
+ .panel-heading = t('.hint')
.panel-body
- = row(label: '.passed_tests', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
- = row(label: 'activerecord.attributes.submission.score', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
- = row(label: '.feedback')
- = row(label: '.output', value: link_to(t('shared.show'), '#'))
- #score data-maximum-score=@exercise.maximum_score data-score=@submission.try(:score)
- h4
- span == "#{t('activerecord.attributes.submission.score')}: "
- span.score
- .progress
- .progress-bar role='progressbar'
- br
- p.text-center = render('editor_button', classes: 'btn-lg btn-success', data: {:'data-message-confirm' => t('exercises.editor.confirm_submit'), :'data-url' => submit_exercise_path(@exercise)}, icon: 'fa fa-send', id: 'submit', label: t('exercises.editor.submit'))
+ #output
+ pre = t('.no_output_yet')
+ - if CodeOcean::Config.new(:code_ocean).read[:flowr][:enabled]
+ #flowrHint.panel.panel-info data-url=CodeOcean::Config.new(:code_ocean).read[:flowr][:url] role='tab'
+ .panel-heading = 'Gain more insights here'
+ .panel-body
+ #progress.tab-pane
+ #results
+ h2 = t('.results')
+ p.test-count == t('.test_count', count: 0)
+ ul.list-unstyled
+ ul#dummies.hidden.list-unstyled
+ li.panel.panel-default
+ .panel-heading
+ h3.panel-title == t('.file', filename: '', number: 0)
+ .panel-body
+ = row(label: '.passed_tests', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
+ = row(label: 'activerecord.attributes.submission.score', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
+ = row(label: '.feedback')
+ = row(label: '.output', value: link_to(t('shared.show'), '#'))
+ #score data-maximum-score=@exercise.maximum_score data-score=@submission.try(:score)
+ h4
+ span == "#{t('activerecord.attributes.submission.score')}: "
+ span.score
+ .progress
+ .progress-bar role='progressbar'
+ br
+ p.text-center = render('editor_button', classes: 'btn-lg btn-success', data: {:'data-message-confirm' => t('exercises.editor.confirm_submit'), :'data-url' => submit_exercise_path(@exercise)}, icon: 'fa fa-send', id: 'submit', label: t('exercises.editor.submit'))
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 45be24af..0bacc13e 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -188,6 +188,9 @@ de:
form:
add_file: Datei hinzufügen
implement:
+ alert:
+ text: 'Ihr Browser unterstützt nicht alle Funktionalitäten, die %{application_name} benötigt. Bitte nutzen Sie einen modernen Browser, um %{application_name} zu besuchen.'
+ title: Ihr Browser wird nicht unterstützt!
default_feedback: Sehr gut. Alle Tests waren erfolgreich.
feedback: Feedback
file: 'Test-Datei %{number} (%{filename})'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 019f4ed4..e43dee29 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -188,6 +188,9 @@ en:
form:
add_file: Add file
implement:
+ alert:
+ text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'
+ title: Your browser is not supported!
default_feedback: Well done. All tests have been passed.
feedback: Feedback
file: 'Test File %{number} (%{filename})'