@myshixun.shixun.language == "Html"
This commit is contained in:
parent
dfa5a1013e
commit
77ea22173e
|
|
@ -1,5 +1,7 @@
|
|||
class IframesController < ApplicationController
|
||||
layout false
|
||||
skip_before_filter :verify_authenticity_token, :only => [:html_content]
|
||||
|
||||
def show
|
||||
render :layout => false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,12 +32,14 @@
|
|||
<script>
|
||||
// 如果是HTML实训,则在效果显示栏实时渲染code
|
||||
<% if @shixun.language == "Html" %>
|
||||
setTimeout(tpi_html_show, 1000);
|
||||
setTimeout(tpi_html_show, 1000);
|
||||
<% end %>
|
||||
// 渲染用户的HTML的CODE。
|
||||
function tpi_html_show(){
|
||||
var contents = editor_CodeMirror.getValue();
|
||||
$("#html_contents").attr("src", "/iframes/html_content?contents="+contents);
|
||||
$("#data_param").val(contents);
|
||||
$("#html_form").attr("action", "/iframes/html_content");
|
||||
$("#html_form").submit();
|
||||
}
|
||||
/* -------------- 点击加载上次通过的代码----------------*/
|
||||
$("#task_popup_confirm").live("click", function(){
|
||||
|
|
|
|||
|
|
@ -123,6 +123,9 @@
|
|||
// codemmirror键盘按下事件,用来触发自动补全代码功能
|
||||
editor_CodeMirror.on("keyup", function(editor, event)
|
||||
{
|
||||
<% if @myshixun.shixun.language == "Html" %>
|
||||
return;
|
||||
<% end %>
|
||||
var __Cursor = editor.getDoc().getCursor();
|
||||
var __Token = editor.getTokenAt(__Cursor);
|
||||
/* // 当前行变化时,codemirror的js会改变gutter的结构,因此要在此需要再增加标示
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
resources :iframes do
|
||||
collection do
|
||||
|
||||
match 'html_content', :via => [:get, :post]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -376,7 +376,10 @@ function code_evaluation(test_sets,
|
|||
$b = "<div class=\"fit -scroll\">" +
|
||||
"<div class=\"-layout-v -fit\">" +
|
||||
"<div class=\"-flex -scroll task-padding16 loading-center undis\" id=\"html_ajax_loading\"></div>" +
|
||||
"<iframe frameborder=\"0\" name=\"i\" src=\"/iframes/html_content\" id=\"html_contents\" style='background: #fff;height: 100%;'>" +
|
||||
"<form id=\"html_form\" method=\"post\" target=\"myFrame\">" +
|
||||
"<input type=\"hidden\" name=\"contents\" id=\"data_param\" />" +
|
||||
"</form>" +
|
||||
"<iframe frameborder=\"0\" name=\"myFrame\" style='background: #fff;height: 100%;'>" +
|
||||
"</iframe>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
|
|
|
|||
Loading…
Reference in New Issue