add: projects create validate length
This commit is contained in:
		
							parent
							
								
									1c111e83b3
								
							
						
					
					
						commit
						604c2595d3
					
				| 
						 | 
				
			
			@ -7,6 +7,10 @@ class Projects::CreateForm < BaseForm
 | 
			
		|||
            :project_category_id, :project_language_id, presence: true
 | 
			
		||||
  validates :repository_name, format: { with: REPOSITORY_NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
 | 
			
		||||
 | 
			
		||||
  validates :name, length: { maximum: 50 }
 | 
			
		||||
  validates :repository_name, length: { maximum: 100 }
 | 
			
		||||
  validates :description, length: { maximum: 200 }
 | 
			
		||||
 | 
			
		||||
  validate :check_ignore, :check_license, :check_owner, :check_max_repo_creation
 | 
			
		||||
  validate do
 | 
			
		||||
    check_project_category(project_category_id)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
'zh-CN':
 | 
			
		||||
  activemodel:
 | 
			
		||||
    attributes:
 | 
			
		||||
      projects/create_form:
 | 
			
		||||
        name: 项目名称
 | 
			
		||||
        repository_name: 仓库名称
 | 
			
		||||
        description: 项目简介
 | 
			
		||||
		Loading…
	
		Reference in New Issue