Backport changes to Gitlab::Tempalte::BaseTemplate

parent 803bf517
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)
def name
File.basename(@path, self.class.extension)
alias_method :id, :name
def content
......@@ -62,7 +66,7 @@ def by_category(category, project = nil)
directory = category_directory(category)
files = finder(project).list_files_for(directory) { |f| new(f, project) }.sort { |f| new(f, project, category: category) }.sort
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