【生产环境】实训配置页的评测脚本选择后,无法清空,必须通过重新技术平台才行

dev_haigong
daiao 6 years ago
parent 4cd1f7c305
commit 49cf70f38f

@ -1163,6 +1163,9 @@ class ShixunsController < ApplicationController
end end
def get_script_contents def get_script_contents
if params[:script_id].to_i == -1
render :json => {contents: "", description: ""}
else
mirrir_script = MirrorScript.find(params[:script_id]) mirrir_script = MirrorScript.find(params[:script_id])
script = mirrir_script.try(:script) script = mirrir_script.try(:script)
description = mirrir_script.try(:description) description = mirrir_script.try(:description)
@ -1170,6 +1173,8 @@ class ShixunsController < ApplicationController
render :json => {contents: script, description: description} render :json => {contents: script, description: description}
end end
end
def get_common_script def get_common_script
shixun_script = PlatformSample.where(:samples_type => "script").first.try(:contents) shixun_script = PlatformSample.where(:samples_type => "script").first.try(:contents)
compile = params[:compile] compile = params[:compile]

@ -85,8 +85,9 @@
<div class="clearfix"> <div class="clearfix">
<div class="with15 pr fl" <%= @power ? "select-for" : "" %>> <div class="with15 pr fl" <%= @power ? "select-for" : "" %>>
<input type="hidden" name="mirror_script" id="shixun_scenario" value="<%= @shixun.script_tag.try(:id) %>"> <input type="hidden" name="mirror_script" id="shixun_scenario" value="<%= @shixun.script_tag.try(:id) %>">
<input type="text" id="shixun_scenario_name" class="task-height-40 task-form-100 panel-box-sizing pr20 color-grey3 font-14" readonly placeholder="请选择脚本" value="<%= @shixun.script_tag.try(:script_type) %>"/> <input type="text" id="shixun_scenario_name" class="task-height-40 task-form-100 panel-box-sizing pr20 color-grey3 font-14" readonly placeholder="请选择脚本" value="<%= @shixun.script_tag.try(:script_type) ? @shixun.script_tag.try(:script_type) : "无" %>"/>
<div class="down-select bor-grey-e user_bg_shadow" id="shixun_scenario_option"> <div class="down-select bor-grey-e user_bg_shadow" id="shixun_scenario_option">
<p data-shixun-value="-1" title="无">无</p>
<% @shixun.standrad_script.each do |script| %> <% @shixun.standrad_script.each do |script| %>
<p data-shixun-value="<%= script.id %>" title="<%= script.script_type %>"><%= script.script_type %></p> <p data-shixun-value="<%= script.id %>" title="<%= script.script_type %>"><%= script.script_type %></p>
<% end %> <% end %>

Loading…
Cancel
Save