Commit d65e31ab authored by Nick Thomas's avatar Nick Thomas

Backport changes to Gitlab::Tempalte::BaseTemplate

parent 803bf517
module Gitlab module Gitlab
module Template module Template
class BaseTemplate class BaseTemplate
def initialize(path, project = nil) attr_reader :category
def initialize(path, project = nil, category: nil)
@path = path @path = path
@category = category
@finder = self.class.finder(project) @finder = self.class.finder(project)
end end
def name def name
File.basename(@path, self.class.extension) File.basename(@path, self.class.extension)
end end
alias_method :id, :name
def content def content
@finder.read(@path) @finder.read(@path)
...@@ -62,7 +66,7 @@ module Gitlab ...@@ -62,7 +66,7 @@ module Gitlab
directory = category_directory(category) directory = category_directory(category)
files = finder(project).list_files_for(directory) files = finder(project).list_files_for(directory)
files.map { |f| new(f, project) }.sort files.map { |f| new(f, project, category: category) }.sort
end end
def category_directory(category) def category_directory(category)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment