实训开启逻辑不合理处理,改成点击后判断逻辑及弹框
This commit is contained in:
parent
fc987af60b
commit
70940aa38b
|
|
@ -450,6 +450,13 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 实训行为操作
|
||||
def operation
|
||||
@myshixun = Myshixun.where(:id => params[:myshixun_id]).first
|
||||
@is_modify = ShixunModify.where(:myshixun_id => params[:myshixun_id], :shixun_id => @shixun.try(:id), :status => 1).first
|
||||
@mail = User.current.mail.blank?
|
||||
end
|
||||
|
||||
private
|
||||
# REDO: 新增类型copy的时候
|
||||
# 复制项目
|
||||
|
|
|
|||
|
|
@ -9,18 +9,21 @@
|
|||
<% if allow_shixun_exec(@shixun) %>
|
||||
<% if @shixun.status == 0 %>
|
||||
<% if User.current.manager_of_shixun?(@shixun) %>
|
||||
<%= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
|
||||
<%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :remote => true %>
|
||||
<%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
|
||||
<a href="javascript:void(0);" data-option="1" onclick="apply_publish_shixun('<%= publish_shixun_path(@shixun) %>')" id="apply_publish_shixun" class="fr shixun-task-btn task-btn-green mr15">申请发布</a>
|
||||
<%#= link_to "申请发布", publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15", :id => "challenge_begin", :remote => true %>
|
||||
<% end %>
|
||||
<% elsif @shixun.status == 1 %>
|
||||
<%= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
|
||||
<%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :remote => true %>
|
||||
<%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
|
||||
<% if User.current.manager_of_shixun?(@shixun) %>
|
||||
<%= link_to "撤销发布", cancel_publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-grey-white mr15", :id => "challenge_begin" %>
|
||||
<% end %>
|
||||
<% elsif @shixun.status == 2 %>
|
||||
<% if myshixun.blank? %>
|
||||
<%= link_to_shixun_exec myshixun, @shixun, '开始实战' %>
|
||||
<%= link_to "开始实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :remote => true %>
|
||||
<%#= link_to_shixun_exec myshixun, @shixun, '开始实战' %>
|
||||
<% else %>
|
||||
<%= link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "challenge_begin", :target => "_blank"%>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
<% if @mail %>
|
||||
notice_box_redirect('#{security_settings_path}', '开启实训,请先绑定邮箱')
|
||||
<% else %>
|
||||
<% if @is_modify.blank? %>
|
||||
//为了防止浏览器阻挡
|
||||
var tempwindow = window.open();
|
||||
tempwindow.location = '<%= shixun_exec_shixun_path(@shixun) %>';
|
||||
//window.open("<%#= shixun_exec_shixun_path(@shixun) %>");
|
||||
<% else %>
|
||||
sure_box_redirect('<%= myshixun_reset_myshixun_path(@myshixun) %>', '实训已经更新啦,系统正在为您重置')
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -54,6 +54,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'apply_publish'
|
||||
get 'cancel_publish'
|
||||
get 'close'
|
||||
get 'operation'
|
||||
end
|
||||
collection do
|
||||
match 'search', :via => [:get, :post]
|
||||
|
|
|
|||
Loading…
Reference in New Issue