|
|
|
@ -9,37 +9,17 @@ class Admins::ProjectsController < Admins::BaseController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
if @course.is_delete == 0
|
|
|
|
|
@course.delete!
|
|
|
|
|
Tiding.create!(user_id: current_user.id, trigger_user_id: current_user.id, container_id: @course.id,
|
|
|
|
|
container_type: 'DeleteCourse', tiding_type: 'System', belong_container: @course, extra: @course.name)
|
|
|
|
|
project = Project.find_by!(id: params[:id])
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
g = Gitlab.client
|
|
|
|
|
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!
|
|
|
|
|
render_delete_success
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update
|
|
|
|
|
if @course.update_attributes(setting_params)
|
|
|
|
|
render_ok
|
|
|
|
|
else
|
|
|
|
|
redirect_to admins_courses_path
|
|
|
|
|
flash[:danger] = "更新失败"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def homepage_show
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def email_notify
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def find_course
|
|
|
|
|
@course = Course.find_by!(id: params[:id])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def setting_params
|
|
|
|
|
params.permit(:homepage_show, :email_notify)
|
|
|
|
|
end
|
|
|
|
|
end
|