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 %>