2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class YoutrackService < IssueTrackerService
|
|
|
|
validates :project_url, :issues_url, presence: true, public_url: true, if: :activated?
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
# {PROJECT-KEY}-{NUMBER} Examples: YT-1, PRJ-1, gl-030
|
2019-07-07 11:18:12 +05:30
|
|
|
def self.reference_pattern(only_long: false)
|
|
|
|
if only_long
|
2020-03-09 13:42:32 +05:30
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)/
|
2019-07-07 11:18:12 +05:30
|
|
|
else
|
2020-03-09 13:42:32 +05:30
|
|
|
/(?<issue>\b[A-Za-z][A-Za-z0-9_]*-\d+\b)|(#{Issue.reference_prefix}(?<issue>\d+))/
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
def default_title
|
2019-07-07 11:18:12 +05:30
|
|
|
'YouTrack'
|
|
|
|
end
|
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
def default_description
|
|
|
|
s_('IssueTracker|YouTrack issue tracker')
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.to_param
|
|
|
|
'youtrack'
|
|
|
|
end
|
|
|
|
|
|
|
|
def fields
|
|
|
|
[
|
|
|
|
{ type: 'text', name: 'description', placeholder: description },
|
|
|
|
{ type: 'text', name: 'project_url', placeholder: 'Project url', required: true },
|
|
|
|
{ type: 'text', name: 'issues_url', placeholder: 'Issue url', required: true }
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|