Class: Gitlab::Template::IssueTemplate

Inherits:
BaseTemplate show all
Defined in:
lib/gitlab/template/issue_template.rb

Instance Attribute Summary

Attributes inherited from BaseTemplate

#category

Class Method Summary collapse

Methods inherited from BaseTemplate

#<=>, all, categories, category_directory, #content, #description, find, #full_name, #initialize, #name, #project_id, repository_template_names, #resolve!, template_names_by_category, template_subsets, #to_json

Constructor Details

This class inherits a constructor from Gitlab::Template::BaseTemplate

Class Method Details

.base_dirObject



11
12
13
# File 'lib/gitlab/template/issue_template.rb', line 11

def base_dir
  '.gitlab/issue_templates/'
end

.by_category(category, project = nil, empty_category_title: nil) ⇒ Object



29
30
31
# File 'lib/gitlab/template/issue_template.rb', line 29

def by_category(category, project = nil, empty_category_title: nil)
  super(category, project, empty_category_title: _('Project Templates'))
end

.extensionObject



7
8
9
# File 'lib/gitlab/template/issue_template.rb', line 7

def extension
  '.md'
end

.finder(project) ⇒ Object



15
16
17
# File 'lib/gitlab/template/issue_template.rb', line 15

def finder(project)
  Gitlab::Template::Finders::RepoTemplateFinder.new(project, self.base_dir, self.extension, self.categories)
end

.template_names(project) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/gitlab/template/issue_template.rb', line 19

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