warn in case of lacking client-side SSE support
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -16,6 +16,14 @@ button i.fa-spin {
|
||||
}
|
||||
}
|
||||
|
||||
.score {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#alert, #development-environment {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#editor-buttons {
|
||||
background-color: #008CBA;
|
||||
margin-top: 1em;
|
||||
|
@ -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'))
|
||||
|
Reference in New Issue
Block a user