mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
新增:创建项目auto_init参数
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Projects::CreateForm < BaseForm
|
||||
attr_accessor :user_id, :name, :description, :repository_name, :project_category_id,
|
||||
:project_language_id, :ignore_id, :license_id, :private, :owner
|
||||
:project_language_id, :ignore_id, :license_id, :private, :owner, :auto_init
|
||||
|
||||
validates :user_id, :name, :repository_name, presence: true
|
||||
validates :repository_name, format: { with: CustomRegexp::REPOSITORY_NAME_REGEX, multiline: true, message: "项目标识只能包含数字,字母,下划线(_),中划线(-),英文句号(.),必须以数字和字母开头,不能以下划线/中划线/英文句号开头和结尾" }
|
||||
@@ -9,7 +9,7 @@ class Projects::CreateForm < BaseForm
|
||||
validates :repository_name, length: { maximum: 100 }
|
||||
validates :description, length: { maximum: 200 }
|
||||
|
||||
validate :check_ignore, :check_license, :check_owner, :check_max_repo_creation
|
||||
validate :check_ignore, :check_license, :check_auto_init, :check_owner, :check_max_repo_creation
|
||||
validate do
|
||||
check_project_category(project_category_id)
|
||||
check_project_language(project_language_id)
|
||||
@@ -25,6 +25,10 @@ class Projects::CreateForm < BaseForm
|
||||
raise "ignore_id值无效." if ignore_id && Ignore.find_by(id: ignore_id).blank?
|
||||
end
|
||||
|
||||
def check_auto_init
|
||||
raise "auto_init值无效." if ignore_id && license_id && !auto_init
|
||||
end
|
||||
|
||||
def check_owner
|
||||
@project_owner = Owner.find_by(id: user_id)
|
||||
raise "user_id值无效." if user_id && @project_owner.blank?
|
||||
|
||||
Reference in New Issue
Block a user