Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-09-05 17:17:29 +0300
committerNick Thomas <nick@gitlab.com>2018-09-05 17:19:20 +0300
commitd65e31ab72b09c539fac4bac391d1f6ff3152c58 (patch)
tree6460a6f1bcdef534ba5e3a6a23b7e9d9b9eff2c6 /lib/gitlab/template
parent803bf517f8dc804a1b9acbbe0482a5fd63f577a2 (diff)
Backport changes to Gitlab::Tempalte::BaseTemplate
Diffstat (limited to 'lib/gitlab/template')
-rw-r--r--lib/gitlab/template/base_template.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/template/base_template.rb b/lib/gitlab/template/base_template.rb
index 7393574ac13..3770f3f250b 100644
--- a/lib/gitlab/template/base_template.rb
+++ b/lib/gitlab/template/base_template.rb
@@ -1,14 +1,18 @@
module Gitlab
module Template
class BaseTemplate
- def initialize(path, project = nil)
+ attr_reader :category
+
+ def initialize(path, project = nil, category: nil)
@path = path
+ @category = category
@finder = self.class.finder(project)
end
def name
File.basename(@path, self.class.extension)
end
+ alias_method :id, :name
def content
@finder.read(@path)
@@ -62,7 +66,7 @@ module Gitlab
directory = category_directory(category)
files = finder(project).list_files_for(directory)
- files.map { |f| new(f, project) }.sort
+ files.map { |f| new(f, project, category: category) }.sort
end
def category_directory(category)