针对实训子项目,一些权限修改
This commit is contained in:
parent
705f94428e
commit
019ce762f8
|
@ -837,6 +837,9 @@ class ProjectsController < ApplicationController
|
|||
if @project.training_tasks.count == 0
|
||||
@notice = "实训开启失败:请先发布实训任务"
|
||||
return
|
||||
elsif Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").count == 0
|
||||
@notice = "实训开启失败:请先创建版本库"
|
||||
return
|
||||
end
|
||||
jobName = "#{@project.id}"
|
||||
pipeLine = "#{Base64.encode64(@project.script)}"
|
||||
|
@ -856,7 +859,11 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
# TrainintTask.status 0:评测中 1:评测成功 2:评测惊醒中
|
||||
# 非项目成员、非实训子项目不允许执行该方法
|
||||
def task_execute
|
||||
if !@project.is_child_training_project? || !User.current.member_of?(@project)
|
||||
return render_403
|
||||
end
|
||||
taskId = params[:training_task_id]
|
||||
jobName = @project.forked_from_project_id
|
||||
@training_task = TrainingTask.find(taskId)
|
||||
|
@ -938,7 +945,7 @@ class ProjectsController < ApplicationController
|
|||
training_task.author_id = User.current.id
|
||||
if training_task.save
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_training_tasks_url(:project_id => new_training_project_id)}
|
||||
format.html{redirect_to project_url(new_training_project_id)}
|
||||
end
|
||||
else
|
||||
raise "create task failed"
|
||||
|
|
|
@ -46,9 +46,12 @@
|
|||
<div class="mb10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<% if @project.is_child_training_project? %>
|
||||
<div id="training_project_task_status_<%= activity.id %>">
|
||||
<%= render :partial => "training_tasks/action_status", :locals => {:activity => activity} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
<% elsif activity.status == 2 %>
|
||||
<span class="task-display-span alert-blue mt10">当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) && @project.is_child_training_project? %>
|
||||
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :remote => true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -26,18 +26,12 @@
|
|||
</div>
|
||||
</td>
|
||||
<td >
|
||||
<% if activity.journals.count != 0 %>
|
||||
<% if true %>
|
||||
<a href="javascript:void(0);" class="issues_icons_mes fl mr5 ml5 "></a>
|
||||
<a href="javascript:void(0);" class="fl mt2"><%= activity.journals.count %></a>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if @project.is_child_training_project? %>
|
||||
<div id="task_action_status_<%= activity.id %>">
|
||||
<%= render :partial => 'action_status', :locals => {:activity => activity} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue