37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
|
$("#about_hwork_<%= @work.id%>").html("");
|
|
}
|
|
else{
|
|
$(".about_hwork").html("");
|
|
<% if @homework.homework_type == 2%>
|
|
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
|
|
|
var program_name = "text/x-csrc";
|
|
var language = <%= @homework.language %>;
|
|
if (language == 1) {
|
|
program_name = 'text/x-csrc';
|
|
} else if(language==2){
|
|
program_name = 'text/x-c++src';
|
|
}else if(language==3){
|
|
program_name = 'text/x-cython';
|
|
} else if(language==4){
|
|
program_name = 'text/x-java';
|
|
}
|
|
|
|
var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
|
|
mode: {name: program_name,
|
|
version: 2,
|
|
singleLineStringErrors: false},
|
|
lineNumbers: true,
|
|
indentUnit: 2,
|
|
matchBrackets: true,
|
|
readOnly: true,
|
|
value: $("#work-src_<%= @work.id%>").text()
|
|
}
|
|
);
|
|
|
|
<% else%>
|
|
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
|
<% end%>
|
|
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
|
} |