Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
b4e7bff6ce
|
@ -21,19 +21,22 @@
|
|||
class ProjectsController < ApplicationController
|
||||
layout 'base_projects'
|
||||
before_filter :authorize1, :only => [:show]
|
||||
menu_item :overview, :only => :show
|
||||
menu_item :roadmap, :only => :roadmap
|
||||
menu_item :settings, :only => :settings
|
||||
menu_item :homework, :only => [:homework, :new_homework]
|
||||
menu_item :feedback, :only => :feedback
|
||||
menu_item :share, :only => :share
|
||||
|
||||
# menu_item :overview, :only => :show
|
||||
# menu_item :roadmap, :only => :roadmap
|
||||
# menu_item :settings, :only => :settings
|
||||
# menu_item :homework, :only => [:homework, :new_homework]
|
||||
# menu_item :feedback, :only => :feedback
|
||||
# menu_item :share, :only => :share
|
||||
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
|
||||
skip_before_filter :check_if_login_required, :only => [:training_task_status]
|
||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,
|
||||
:view_homework_attaches,:join_project, :project_home, :training_execute, :training_task_status]
|
||||
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
|
||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
|
||||
before_filter :file
|
||||
|
||||
|
||||
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
|
||||
# before_filter :memberAccess, only: :member
|
||||
|
||||
|
@ -827,6 +830,9 @@ class ProjectsController < ApplicationController
|
|||
# 已经实训过直接跳入
|
||||
#
|
||||
def training_chiled_project_exec
|
||||
if !User.current.logged?
|
||||
return render_403
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -879,8 +885,14 @@ class ProjectsController < ApplicationController
|
|||
taskId = params[:training_task_id]
|
||||
jobName = @project.forked_from_project_id
|
||||
@training_task = TrainingTask.find(taskId)
|
||||
step = @training_task.position
|
||||
|
||||
rep_identify = Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
gitUrl = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ rep_identify + "."+"git"
|
||||
gitUrl = Base64.encode64(gitUrl)
|
||||
if @training_task.status == 0
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}"}
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
begin
|
||||
res = uri_exec uri, params
|
||||
|
@ -932,7 +944,7 @@ class ProjectsController < ApplicationController
|
|||
def training_task_status
|
||||
status = params[:status].to_i
|
||||
task_id = params[:taskId]
|
||||
message = params[:msg]
|
||||
message = Base64.decode64(params[:msg])
|
||||
begin
|
||||
@training_task = TrainingTask.find(task_id)
|
||||
# 如果已经执行成功过,则不重复执行
|
||||
|
@ -949,8 +961,7 @@ class ProjectsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
if position < original_tasks_count
|
||||
# 继续发布下一个任务
|
||||
position = position + 1
|
||||
publish_training_tasks original_project_id, @training_task.project_id, position
|
||||
publish_training_tasks original_project_id, @training_task.project_id, position + 1
|
||||
end
|
||||
@training_task.update_attribute(:status, 1)
|
||||
# 创建一条回复提醒
|
||||
|
|
|
@ -149,7 +149,11 @@ class TrainingTasksController < ApplicationController
|
|||
def update
|
||||
return unless build_new_task_from_params
|
||||
@training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
|
||||
if @training_task.update_attributes(params[:training_task])
|
||||
# params[:training_task][:position] = params[:training_task][:position].to_i
|
||||
@training_task.position = params[:training_task][:position].to_i
|
||||
@training_task.subject = params[:training_task][:subject]
|
||||
@training_task.description = params[:training_task][:description]
|
||||
if @training_task.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{redirect_to training_task_url(@training_task)}
|
||||
|
|
|
@ -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)},
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
<div class="pro_new_top clear mb10">
|
||||
<div class="fl pro_new_name ml15 clear">
|
||||
<% unless @project.is_public? %><span class="icons_newpro_lock fl "></span><% end %>
|
||||
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
|
||||
<% if @project.is_training_project? %>
|
||||
<%=link_to "#{@project.owner.try(:show_name)}导师<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
|
||||
<% else %>
|
||||
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
|
||||
<% end %>
|
||||
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -77,8 +77,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div><!--sy_class_leftnav end-->
|
||||
<% update_visiti_count @contest %>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @contest.visits.to_i %> (自2016年5月)</div>
|
||||
</div><!--sy_class_l end-->
|
||||
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<div class="fl">
|
||||
<%= yield %>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue