Commit 5ae45926 authored by Douwe Maan's avatar Douwe Maan

Also inject new route helpers into includers of GitlabRoutingHelper

parent 69e17c22
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
module GitlabRoutingHelper module GitlabRoutingHelper
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do
Gitlab::Routing.includes_helpers(self)
end
# Project # Project
def project_tree_path(project, ref = nil, *args) def project_tree_path(project, ref = nil, *args)
namespace_project_tree_path(project.namespace, project, ref || @ref || project.repository.root_ref, *args) # rubocop:disable Cop/ProjectPathHelper namespace_project_tree_path(project.namespace, project, ref || @ref || project.repository.root_ref, *args) # rubocop:disable Cop/ProjectPathHelper
......
...@@ -6,21 +6,26 @@ module Gitlab ...@@ -6,21 +6,26 @@ module Gitlab
self._includers = [] self._includers = []
included do included do
Gitlab::Routing._includers << self Gitlab::Routing.includes_helpers(self)
include Gitlab::Routing.url_helpers include Gitlab::Routing.url_helpers
end end
def self.includes_helpers(klass)
self._includers << klass
end
def self.add_helpers(mod) def self.add_helpers(mod)
url_helpers.include mod url_helpers.include mod
url_helpers.extend mod url_helpers.extend mod
GitlabRoutingHelper.include mod
GitlabRoutingHelper.extend mod
app_url_helpers = Gitlab::Application.routes.named_routes.url_helpers_module app_url_helpers = Gitlab::Application.routes.named_routes.url_helpers_module
app_url_helpers.include mod app_url_helpers.include mod
app_url_helpers.extend mod app_url_helpers.extend mod
GitlabRoutingHelper.include mod
GitlabRoutingHelper.extend mod
_includers.each do |klass| _includers.each do |klass|
klass.include mod klass.include mod
end end
......
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