Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
yuanke 2016-10-21 14:35:36 +08:00
commit 0d885100b3
3 changed files with 16 additions and 2 deletions

View File

@ -691,9 +691,22 @@ class ProjectsController < ApplicationController
redirect_to settings_project_url(@project, :tab => 'modules')
end
GITLABTYPE = "Repository::Gitlab"
def archive
if request.post?
unless @project.archive
if @project.archive
# 删除版本库信息
begin
g = Gitlab.client
g.delete_project(@project.gpid)
rescue Exception => e
puts e
end
# 删除Trustie班额本库记录
repoisitory = Repository.where(:project_id => @project.id, :type => GITLABTYPE).first
repoisitory.delete
@project.update_column(:gpid, nil)
else
flash[:error] = l(:error_can_not_archive_project)
end
end

View File

@ -41,7 +41,7 @@
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5">
<%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" },
:data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %>
:data => {:confirm => l(:text_delete_project_are_you_sure)}, :method => :post) unless @project.archived? %>
<%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
<span>(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</span>
</div>

View File

@ -189,6 +189,7 @@ zh:
text_are_you_sure: 您确定要删除吗? #js 提示
text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗?
text_delete_project_are_you_sure: 本项目包含版本库,项目删除后,版本库将被彻底删除。您确定删除吗?
text_are_you_sure_out: 你确定要退出该班级吗?
text_are_you_sure_out_group: 你确定要退出该分班吗?
text_are_you_sure_all: 您确定要删除所有文件吗