修改部分bug
This commit is contained in:
parent
efad719de0
commit
0b3683b99e
|
@ -12,14 +12,14 @@ class Admins::ProjectsController < Admins::BaseController
|
||||||
def destroy
|
def destroy
|
||||||
project = Project.find_by!(id: params[:id])
|
project = Project.find_by!(id: params[:id])
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
g = Gitlab.client
|
Gitea::Repository::DeleteService.new(project.owner, project.identifier).call
|
||||||
g.delete_project(project.gpid)
|
|
||||||
# 删除Trustie版本库记录
|
|
||||||
repoisitory = Repository.where(project_id: project.id, type: "Repository::Gitlab").first
|
|
||||||
repoisitory.destroy!
|
|
||||||
Tiding.where(container_id: project.id, container_type: ["JoinProject", "DealProject", "ReporterJoinProject", "ManagerJoinProject"]).destroy_all
|
|
||||||
project.destroy!
|
project.destroy!
|
||||||
render_delete_success
|
# render_delete_success
|
||||||
|
redirect_to admins_projects_path
|
||||||
|
flash[:success] = "删除成功"
|
||||||
|
rescue Exception => e
|
||||||
|
redirect_to admins_projects_path
|
||||||
|
flash[:danger] = "删除失败"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -30,7 +30,7 @@ class Projects::CreateService < ApplicationService
|
||||||
description: params[:description],
|
description: params[:description],
|
||||||
project_category_id: params[:project_category_id],
|
project_category_id: params[:project_category_id],
|
||||||
project_language_id: params[:project_language_id],
|
project_language_id: params[:project_language_id],
|
||||||
is_public: get_is_public,
|
is_public: repo_is_public,
|
||||||
ignore_id: params[:ignore_id],
|
ignore_id: params[:ignore_id],
|
||||||
license_id: params[:license_id],
|
license_id: params[:license_id],
|
||||||
identifier: params[:repository_name] #新增,hs
|
identifier: params[:repository_name] #新增,hs
|
||||||
|
@ -39,7 +39,7 @@ class Projects::CreateService < ApplicationService
|
||||||
|
|
||||||
def repository_params
|
def repository_params
|
||||||
{
|
{
|
||||||
hidden: repo_is_public,
|
hidden: get_is_public,
|
||||||
user_id: params[:user_id],
|
user_id: params[:user_id],
|
||||||
identifier: params[:repository_name]
|
identifier: params[:repository_name]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
<table class="table table-hover text-center subject-list-table">
|
<table class="table table-hover text-center subject-list-table">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="4%">序号</th>
|
<th width="4%">序号</th>
|
||||||
<th width="4%">ID</th>
|
<th width="4%">ID</th>
|
||||||
<th width="15%" class="text-left">项目名称</th>
|
<th width="15%" class="text-left">项目名称</th>
|
||||||
<th width="6%">公开</th>
|
<th width="6%">公开</th>
|
||||||
<th width="5%">issue</th>
|
<th width="5%">issue</th>
|
||||||
<th width="5%">资源</th>
|
<th width="5%">资源</th>
|
||||||
<th width="6%">版本库</th>
|
<th width="6%">版本库</th>
|
||||||
<th width="8%">PullRequest</th>
|
<th width="8%">PullRequest</th>
|
||||||
<th width="6%">里程碑</th>
|
<th width="6%">里程碑</th>
|
||||||
<th width="10%">成员</th>
|
<th width="10%">成员</th>
|
||||||
<th width="10%">管理员</th>
|
<th width="10%">管理员</th>
|
||||||
<th width="11%"><%= sort_tag('创建时间', name: 'created_on', path: admins_projects_path) %></th>
|
<th width="11%"><%= sort_tag('创建时间', name: 'created_on', path: admins_projects_path) %></th>
|
||||||
<th width="10%">操作</th>
|
<th width="10%">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% if projects.present? %>
|
<% if projects.present? %>
|
||||||
<% projects.each_with_index do |project, index| %>
|
<% projects.each_with_index do |project, index| %>
|
||||||
<tr class="project-item-<%= project.id %>">
|
<tr class="project-item-<%= project.id %>">
|
||||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||||
<td><%= project.id %></td>
|
<td><%= project.id %></td>
|
||||||
<td class="text-left">
|
<td class="text-left">
|
||||||
<%= link_to(project.name, "/projects/#{project.id}", target: '_blank') %>
|
<%= link_to(project.name, "/projects/#{project.id}", target: '_blank') %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= project.is_public ? '√' : '' %></td>
|
<td><%= project.is_public ? '√' : '' %></td>
|
||||||
<td><%= project.issues.size %></td>
|
<td><%= project.issues.size %></td>
|
||||||
<td><%= project.attachments.size %></td>
|
<td><%= project.attachments.size %></td>
|
||||||
<td><%= project.project_score.try(:changeset_num).to_i %></td>
|
<td><%= project.project_score.try(:changeset_num).to_i %></td>
|
||||||
<td><%= project.project_score.try(:pull_request_num).to_i %></td>
|
<td><%= project.project_score.try(:pull_request_num).to_i %></td>
|
||||||
<td><%= project.versions.size %></td>
|
<td><%= project.versions.size %></td>
|
||||||
<td><%= project.members.size %></td>
|
<td><%= project.members.size %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= project.owner ? link_to(project.owner&.real_name, "/users/#{project.owner&.login}", target: '_blank') : "" %>
|
<%= project.owner ? link_to(project.owner&.real_name, "/users/#{project.owner&.login}", target: '_blank') : "" %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= project.created_on&.strftime('%Y-%m-%d %H:%M') %></td>
|
<td><%= project.created_on&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||||
<td class="action-container">
|
<td class="action-container">
|
||||||
<%= delete_link '删除', admins_project_path(project, element: ".project-item-#{project.id}"), class: 'delete-project-action' %>
|
<%= link_to "删除", admins_project_path(project.id), method: :delete, data:{confirm: "确认删除的吗?"}, class: "delete-project-action" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render 'admins/shared/no_data_for_table' %>
|
<%= render 'admins/shared/no_data_for_table' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue