删除项目的时候删除版本库功能
This commit is contained in:
parent
e1520aff68
commit
cff887a2be
|
@ -691,9 +691,22 @@ class ProjectsController < ApplicationController
|
||||||
redirect_to settings_project_url(@project, :tab => 'modules')
|
redirect_to settings_project_url(@project, :tab => 'modules')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
GITLABTYPE = "Repository::Gitlab"
|
||||||
def archive
|
def archive
|
||||||
if request.post?
|
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)
|
flash[:error] = l(:error_can_not_archive_project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<div class="mt30">
|
<div class="mt30">
|
||||||
<img src="/images/pic_del.gif" class="mr5">
|
<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" },
|
<%= 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=>"确认要删除该课程吗?" %>
|
<%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %>
|
||||||
<span>(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</span>
|
<span>(友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -189,6 +189,7 @@ zh:
|
||||||
|
|
||||||
text_are_you_sure: 您确定要删除吗? #js 提示
|
text_are_you_sure: 您确定要删除吗? #js 提示
|
||||||
text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗?
|
text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗?
|
||||||
|
text_delete_project_are_you_sure: 本项目包含版本库,项目删除后,版本库将被彻底删除。您确定删除吗?
|
||||||
text_are_you_sure_out: 你确定要退出该班级吗?
|
text_are_you_sure_out: 你确定要退出该班级吗?
|
||||||
text_are_you_sure_out_group: 你确定要退出该分班吗?
|
text_are_you_sure_out_group: 你确定要退出该分班吗?
|
||||||
text_are_you_sure_all: 您确定要删除所有文件吗
|
text_are_you_sure_all: 您确定要删除所有文件吗
|
||||||
|
|
Loading…
Reference in New Issue