mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
init project
This commit is contained in:
13
app/forms/contents/create_form.rb
Normal file
13
app/forms/contents/create_form.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class Contents::CreateForm < BaseForm
|
||||
attr_accessor :login, :repo_identifier, :filepath, :branch, :new_branch
|
||||
|
||||
validates :login, :repo_identifier, :filepath, presence: true
|
||||
|
||||
validate :check_branch
|
||||
|
||||
def check_branch
|
||||
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
|
||||
raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
|
||||
end
|
||||
|
||||
end
|
||||
6
app/forms/contents/delete_form.rb
Normal file
6
app/forms/contents/delete_form.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class Contents::DeleteForm < BaseForm
|
||||
attr_accessor :login, :repo_identifier, :filepath, :branch, :new_branch, :sha
|
||||
|
||||
validates :login, :repo_identifier, :filepath, :sha, presence: true
|
||||
|
||||
end
|
||||
13
app/forms/contents/update_form.rb
Normal file
13
app/forms/contents/update_form.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class Contents::UpdateForm < BaseForm
|
||||
attr_accessor :login, :repo_identifier, :filepath, :branch, :new_branch, :sha
|
||||
|
||||
validates :login, :repo_identifier, :filepath, :sha, presence: true
|
||||
|
||||
validate :check_branch
|
||||
|
||||
def check_branch
|
||||
raise "branch和new_branch必须存在一个 " if branch.blank? && new_branch.blank?
|
||||
raise "branch和new_branch只能存在一个" if !branch.blank? && !new_branch.blank?
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user