diff options
Diffstat (limited to 'lib/gitlab/template')
-rw-r--r-- | lib/gitlab/template/base_template.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/template/issue_template.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/template/merge_request_template.rb | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb index 3be77aff07e..dc006877129 100644 --- a/lib/gitlab/template/base_template.rb +++ b/lib/gitlab/template/base_template.rb @@ -87,11 +87,11 @@ module Gitlab raise NotImplementedError end - def by_category(category, project = nil) + def by_category(category, project = nil, empty_category_title: nil) directory = category_directory(category) files = finder(project).list_files_for(directory) - files.map { |f| new(f, project, category: category) }.sort + files.map { |f| new(f, project, category: category.presence || empty_category_title) }.sort end def category_directory(category) diff --git a/lib/gitlab/template/issue_template.rb b/lib/gitlab/template/issue_template.rb index 30fff9bdae9..6e579018e45 100644 --- a/lib/gitlab/template/issue_template.rb +++ b/lib/gitlab/template/issue_template.rb @@ -25,6 +25,10 @@ module Gitlab # follow-up issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300279 project.repository.issue_template_names_hash end + + def by_category(category, project = nil, empty_category_title: nil) + super(category, project, empty_category_title: _('Project Templates')) + end end end end diff --git a/lib/gitlab/template/merge_request_template.rb b/lib/gitlab/template/merge_request_template.rb index 7491c8f26c6..241a823d870 100644 --- a/lib/gitlab/template/merge_request_template.rb +++ b/lib/gitlab/template/merge_request_template.rb @@ -25,6 +25,10 @@ module Gitlab # follow-up issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300279 project.repository.merge_request_template_names_hash end + + def by_category(category, project = nil, empty_category_title: nil) + super(category, project, empty_category_title: _('Project Templates')) + end end end end |