dev_local
cxt 6 years ago
commit 8ba0fe6b07

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

@ -125,9 +125,21 @@ class ShixunsService
praise_count = d.praise_tread.where(:praise_or_tread => 1).count
user_praise= d.praise_tread.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
# 实训TPM的管理员可以看到隐藏的评论
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position, :user_id => d.user.try(:id), :reward => d.reward,
:image_url => url_to_avatar(d.user), :username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => current_user.manager_of_shixun?(dis, current_user), :praise_count => praise_count, :user_praise => user_praise, :admin => current_user.admin?}
manager = current_user.manager_of_shixun?(dis, current_user)
game_url =
if manager
challenge_id = dis.challenges.where(position: d.position).pluck(:id).first
game_identifier = Game.where(user_id: current_user,
challenge_id: challenge_id).pluck(:identifier).first
"/tasks/#{game_identifier}"
else
""
end
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position,
:user_id => d.user.try(:id), :reward => d.reward, :image_url => url_to_avatar(d.user),
:username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => manager, :praise_count => praise_count, game_url: game_url,
:user_praise => user_praise, :admin => current_user.admin?}
# 现在没有二级回复所以查询的时候直接从root_id取
children = Discuss.where(:root_id => d.id).includes(:user).reorder("created_at asc")

@ -85,8 +85,9 @@
<div class="clearfix">
<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="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">
<p data-shixun-value="-1" title="无">无</p>
<% @shixun.standrad_script.each do |script| %>
<p data-shixun-value="<%= script.id %>" title="<%= script.script_type %>"><%= script.script_type %></p>
<% end %>

Loading…
Cancel
Save