From 49cf70f38fe7eaddf8fd56accb75b86c0b15f681 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 26 Mar 2019 15:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E3=80=91=E5=AE=9E=E8=AE=AD=E9=85=8D=E7=BD=AE=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E8=AF=84=E6=B5=8B=E8=84=9A=E6=9C=AC=E9=80=89=E6=8B=A9=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=97=A0=E6=B3=95=E6=B8=85=E7=A9=BA=EF=BC=8C=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E9=80=9A=E8=BF=87=E9=87=8D=E6=96=B0=E6=8A=80=E6=9C=AF?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=89=8D=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 15 ++++++++++----- app/views/shixuns/_settings_edit.html.erb | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 18107cae..2f07b182 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1163,11 +1163,16 @@ class ShixunsController < ApplicationController end def get_script_contents - mirrir_script = MirrorScript.find(params[:script_id]) - script = mirrir_script.try(:script) - description = mirrir_script.try(:description) - script = modify_shixun_script @shixun, script - render :json => {contents: script, description: description} + if params[:script_id].to_i == -1 + render :json => {contents: "", description: ""} + else + mirrir_script = MirrorScript.find(params[:script_id]) + script = mirrir_script.try(:script) + description = mirrir_script.try(:description) + script = modify_shixun_script @shixun, script + render :json => {contents: script, description: description} + end + end def get_common_script diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index b68a4f57..05ffd841 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -85,8 +85,9 @@
> - + "/>
+

<% @shixun.standrad_script.each do |script| %>

<%= script.script_type %>

<% end %>