@myshixun.shixun.language == "Html"

This commit is contained in:
daiao 2017-09-01 09:16:35 +08:00
parent dfa5a1013e
commit 77ea22173e
5 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,7 @@
class IframesController < ApplicationController
layout false
skip_before_filter :verify_authenticity_token, :only => [:html_content]
def show
render :layout => false
end

View File

@ -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(){

View File

@ -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的结构因此要在此需要再增加标示

View File

@ -159,7 +159,6 @@ RedmineApp::Application.routes.draw do
resources :iframes do
collection do
match 'html_content', :via => [:get, :post]
end
end

View File

@ -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>";