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 '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" %> <%= 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"> <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> </form>
<script type="text/javascript"> <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', mode: {name: 'text/x-c++src',
version: 2, version: 2,
singleLineStringErrors: false}, singleLineStringErrors: false},
lineNumbers: true, lineNumbers: true,
indentUnit: 2, indentUnit: 2,
matchBrackets: true matchBrackets: true,
autofocus: true,
autoRefresh:true
}); });
editor_CodeMirror.on('change',function(cMirror){
editor.on('change',function(cMirror){
// get value right from instance // get value right from instance
$('#challenge-answer-edit-small').val(cMirror.getValue()); $('#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="content clearfix">
<div class="alert alert-blue mr45 mt15 ml15" id="myshixun_tip" > <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> <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 class="tab-info-inner"><%= h @game.ready_knowledge.try(:html_safe) %></div>
</div> </div>
<div id="tab_con_3" class="undis tab-info"> <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> </div>
</div> </div>
@ -47,17 +50,20 @@
</div> </div>
</div> </div>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("myshixun_game_answer"), { var myMirror = $("#game_answer_show")[0];
mode: {name: 'text/x-java', var myCodeMirror = CodeMirror(myMirror, {
version: 2, value: $("#hidden_game_answer").text(),
singleLineStringErrors: false}, mode: "text/x-java",
lineNumbers: true, readOnly: true, //只读
indentUnit: 2, cursorBlinkRate: -1, //隐藏光标
matchBrackets: true autofocus: true,
border: 0
}); });
var web_h = window.innerHeight;
$(document).ready(function(){ $(document).ready(function(){
myCodeMirror.setSize('auto','590px');//设置高度
$("#game_answer_show").children().css("border", 0);
var web_h = window.innerHeight;
if($.browser.msie) { if($.browser.msie) {
$(".content").css("height", web_h - 75 + "px"); $(".content").css("height", web_h - 75 + "px");
$(".tab-info-inner").css("height", web_h * 0.55 + "px"); //IE $(".tab-info-inner").css("height", web_h * 0.55 + "px"); //IE
@ -92,15 +98,6 @@
} }
}); });
//课程大纲tab //课程大纲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(){ $("#close_myshixun_tip").click(function(){
$("#myshixun_tip").hide(); $("#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') %>'); $("#file_entry_content_inner").html('<%= escape_javascript(render :partial => 'games/extend_file_edit_form') %>');
$("#sava_edit_btn1").show(); $("#sava_edit_btn1").show();
$("#sava_edit_btn").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_con_'+n).className='dis';
g('tab_nav_'+n).className='tab_hover'; g('tab_nav_'+n).className='tab_hover';
if(n == 3){
myCodeMirror.refresh();
}
} }
$("#close_myshixun_tip").click(function(){ $("#close_myshixun_tip").click(function(){
$("#myshixun_tip").hide(); $("#myshixun_tip").hide();