设置过关任务图片展示的宽度,参考答案显示用codemirror

This commit is contained in:
daiao 2017-03-30 17:22:32 +08:00
parent 9d770bfcb9
commit bb75bcc72a
2 changed files with 20 additions and 32 deletions

View File

@ -33,7 +33,7 @@
</li>
<li class="clearfix">
<label class="panel-form-label fl">文件路径:</label>
<%= f.text_field :path, :class => "panel-form-width-690 panel-form-height-30 fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件app/controllers/welcome_controller.rb" %>
<%= f.text_field :path, :class => "panel-form-width-690 panel-form-height-30 fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件app/controllers/welcome_controller.rb", :maxlength => "256" %>
</li>
<li class="clearfix">
<label class="panel-form-label fl">预备知识:</label>
@ -270,17 +270,21 @@
$('#edit_challenge_<%= @challenge.id %>').submit();
}
}
challenge_answer_editor = KindEditor.create('#challenge_answer',
{"width":"87.5%",
"resizeType":0,
"no_label":true,
"autoHeightMode":true,
"height":200,
"allowFileManager":true,
afterBlur:function () { this.sync(); },
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"
});
var editor = CodeMirror.fromTextArea(document.getElementById("challenge_answer"), {
mode: {name: 'text/x-java',
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true
});
editor.on('change',function(cMirror){
// get value right from instance
$('#challenge_answer').val(cMirror.getValue());
});
challenge_task_pass_editor = KindEditor.create('#challenge_task_pass',
{"width":"87.5%",
"resizeType":0,
@ -292,23 +296,6 @@
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"
});
challenge_task_editor = KindEditor.create('#challenge_ready_knowledge',
{"width":"87.5%",
"resizeType":0,
"no_label":true,
"autoHeightMode":true,
"height":200,
"allowFileManager":true,
afterBlur:function () { this.sync(); },
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"
});
editor.on('change',function(cMirror){
// get value right from instance
$('#challenge-answer').val(cMirror.getValue());
});
function add_tag(){

View File

@ -28,7 +28,7 @@
</li>
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>过关任务:</label>
<div class="fl task-bg-grey">
<div class="fl task-bg-grey" id="challenge_task_pass">
<%= h @challenge.task_pass.html_safe %>
</div>
</li>
@ -96,5 +96,6 @@
</div>
</div>
</div>
<script>
$('#challenge_task_pass').find('img').css("max-width", "680px")
</script>