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,
|
"ACE_URL": settings.ACE_URL,
|
||||||
"default_lang": default_lang,
|
"default_lang": default_lang,
|
||||||
"problem_id": problem.id,
|
"problem_id": problem.id,
|
||||||
|
"output_only": problem.data_files.output_only,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,22 +21,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_language_template() {
|
function update_language_template() {
|
||||||
var source = $('textarea#id_source');
|
{% if output_only %}
|
||||||
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
|
window.ace_source.env.editor.setReadOnly(true);
|
||||||
var lang_id = $('#id_language').val();
|
{% else %}
|
||||||
var code = localStorage.getItem('submit:' + $('#id_language').val());
|
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) {
|
if (code != null) {
|
||||||
update_submit_area(code);
|
update_submit_area(code);
|
||||||
} else {
|
} else {
|
||||||
$.get('{{ url('language_template_ajax') }}', {
|
$.get('{{ url('language_template_ajax') }}', {
|
||||||
id: lang_id,
|
id: lang_id,
|
||||||
problem: {{problem_id}}
|
problem: {{problem_id}}
|
||||||
}).done(function (template) {
|
}).done(function (template) {
|
||||||
update_submit_area(template);
|
update_submit_area(template);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeDisplayData(data) {
|
function makeDisplayData(data) {
|
||||||
|
|
Loading…
Reference in a new issue