debian-mirror-gitlab/lib/gitlab/template/issue_template.rb

36 lines
1 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
module Gitlab
module Template
class IssueTemplate < BaseTemplate
class << self
def extension
'.md'
end
def base_dir
'.gitlab/issue_templates/'
end
def finder(project)
Gitlab::Template::Finders::RepoTemplateFinder.new(project, self.base_dir, self.extension, self.categories)
end
2021-03-11 19:13:27 +05:30
def template_names(project)
return {} unless project&.repository&.exists?
# here we rely on project.repository caching mechanism. Ideally we would want the template finder to have its
# own caching mechanism to avoid the back and forth call jumps between finder and model.
#
# follow-up issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300279
project.repository.issue_template_names_hash
end
2021-04-17 20:07:23 +05:30
def by_category(category, project = nil, empty_category_title: nil)
super(category, project, empty_category_title: _('Project Templates'))
end
2016-09-13 17:45:13 +05:30
end
end
end
end