Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project

This commit is contained in:
huang 2017-03-27 13:59:35 +08:00
commit 71cb5c297b
4 changed files with 26 additions and 24 deletions

View File

@ -1,5 +1,5 @@
<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c", '/assets/codemirror/autorefresh' %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<form action="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/file_update?path=<%= @path %>" method="post" id="file_update_id" data-remote="true">
@ -12,16 +12,17 @@
</form>
<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
mode: {name: 'text/x-c++src',
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true
matchBrackets: true,
autofocus: true,
autoRefresh:true
});
editor.on('change',function(cMirror){
editor_CodeMirror.on('change',function(cMirror){
// get value right from instance
$('#challenge-answer-edit-small').val(cMirror.getValue());
});

View File

@ -1,3 +1,5 @@
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<div class="content clearfix">
<div class="alert alert-blue mr45 mt15 ml15" id="myshixun_tip" >
<button data-dismiss="alert" class="task-close fr" type="button" id="close_myshixun_tip">×</button>
@ -34,7 +36,8 @@
<div class="tab-info-inner"><%= h @game.ready_knowledge.try(:html_safe) %></div>
</div>
<div id="tab_con_3" class="undis tab-info">
<div class="tab-info-inner" style="line-height: 1.9" id="myshixun_game_answer"><%= h @game.answer.html_safe %></div>
<div class="tab-info-inner" style="line-height: 1.9" id="game_answer_show"></div>
<div class="undis" id="hidden_game_answer"><%= @game.answer.html_safe %></div>
</div>
</div>
</div>
@ -47,17 +50,20 @@
</div>
</div>
<script type="text/javascript" language="javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("myshixun_game_answer"), {
mode: {name: 'text/x-java',
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true
var myMirror = $("#game_answer_show")[0];
var myCodeMirror = CodeMirror(myMirror, {
value: $("#hidden_game_answer").text(),
mode: "text/x-java",
readOnly: true, //只读
cursorBlinkRate: -1, //隐藏光标
autofocus: true,
border: 0
});
var web_h = window.innerHeight;
$(document).ready(function(){
myCodeMirror.setSize('auto','590px');//设置高度
$("#game_answer_show").children().css("border", 0);
var web_h = window.innerHeight;
if($.browser.msie) {
$(".content").css("height", web_h - 75 + "px");
$(".tab-info-inner").css("height", web_h * 0.55 + "px"); //IE
@ -92,15 +98,6 @@
}
});
//课程大纲tab
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=3;i++){
g('tab_nav_'+i).className='tab_nomal';
g('tab_con_'+i).className='undis';
}
g('tab_con_'+n).className='dis';
g('tab_nav_'+n).className='tab_hover';
}
$("#close_myshixun_tip").click(function(){
$("#myshixun_tip").hide();
});

View File

@ -2,4 +2,5 @@ $("#file_entry_content").html('<%= escape_javascript(render :partial => 'games/f
$("#file_entry_content_inner").html('<%= escape_javascript(render :partial => 'games/extend_file_edit_form') %>');
$("#sava_edit_btn1").show();
$("#sava_edit_btn").show();
$("#bottom_save_edit").show();
$("#bottom_save_edit").show();
editor_CodeMirror.refresh();

View File

@ -51,6 +51,9 @@
}
g('tab_con_'+n).className='dis';
g('tab_nav_'+n).className='tab_hover';
if(n == 3){
myCodeMirror.refresh();
}
}
$("#close_myshixun_tip").click(function(){
$("#myshixun_tip").hide();