Disable ace editor for output-only problem
This commit is contained in:
parent
1af44ac9fa
commit
56c5b3dd3c
2 changed files with 19 additions and 14 deletions
|
@ -1194,6 +1194,7 @@ def problem_submit(request, problem, submission=None):
|
|||
"ACE_URL": settings.ACE_URL,
|
||||
"default_lang": default_lang,
|
||||
"problem_id": problem.id,
|
||||
"output_only": problem.data_files.output_only,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -21,22 +21,26 @@
|
|||
}
|
||||
|
||||
function update_language_template() {
|
||||
var source = $('textarea#id_source');
|
||||
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
|
||||
var lang_id = $('#id_language').val();
|
||||
var code = localStorage.getItem('submit:' + $('#id_language').val());
|
||||
{% if output_only %}
|
||||
window.ace_source.env.editor.setReadOnly(true);
|
||||
{% else %}
|
||||
var source = $('textarea#id_source');
|
||||
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
|
||||
var lang_id = $('#id_language').val();
|
||||
var code = localStorage.getItem('submit:' + $('#id_language').val());
|
||||
|
||||
if (code != null) {
|
||||
update_submit_area(code);
|
||||
} else {
|
||||
$.get('{{ url('language_template_ajax') }}', {
|
||||
id: lang_id,
|
||||
problem: {{problem_id}}
|
||||
}).done(function (template) {
|
||||
update_submit_area(template);
|
||||
});
|
||||
if (code != null) {
|
||||
update_submit_area(code);
|
||||
} else {
|
||||
$.get('{{ url('language_template_ajax') }}', {
|
||||
id: lang_id,
|
||||
problem: {{problem_id}}
|
||||
}).done(function (template) {
|
||||
update_submit_area(template);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
function makeDisplayData(data) {
|
||||
|
|
Loading…
Reference in a new issue