没登陆情况不允许开启任务

This commit is contained in:
huang 2017-02-24 21:21:48 +08:00
parent 3abd2d4be6
commit 5be7e048cf
3 changed files with 21 additions and 7 deletions

View File

@ -827,6 +827,9 @@ class ProjectsController < ApplicationController
# 已经实训过直接跳入
#
def training_chiled_project_exec
if !User.current.logged?
return render_403
end
respond_to do |format|
format.js
end

View File

@ -84,6 +84,16 @@
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<% end %>
<% elsif attachment.container_type == 'TrainingTask' %>
<% if User.current == attachment.author %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:class => 'delete',
#:remote => true,
#:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %>
<% end %>
<% else %>
<%= link_to image_tag('delete.png'), attachment_path(attachment),
:data => {:confirm => l(:text_are_you_sure)},

View File

@ -36,14 +36,15 @@
<!--项目fork-->
<li class="mr5 fl">
<!--实训项目条件1、modules中选中了实训任务 2、不是fork的项目-->
<% if @project.is_training_project? && User.current.id != @project.user_id %>
<%= link_to "开始实训", training_chiled_project_exec_project_path(@project), :class => "sy_btn_green fr", :remote => true %>
<% else %>
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
<% if User.current.logged? %>
<% if @project.is_training_project? && User.current.id != @project.user_id %>
<%= link_to "开始实训", training_chiled_project_exec_project_path(@project), :class => "sy_btn_green fr", :remote => true %>
<% else %>
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", forked_pop_project_path(@project),
:class=>"pro_new_topbtn_left fl", :remote => true %>
<a href="<%= member_forked_project_path(@project) %>" class=" pro_new_topbtn fl" title="fork成员列表"><%= project_fork_count %></a>
<% end %>
<% end %>
</li>