Module: Gitlab::Routing

Extended by:
ActiveSupport::Concern
Included in:
API::Entities::Branch, API::Entities::ProjectRepositoryStorage, API::Entities::ProjectUpload, AlertManagement::HttpIntegration, Atlassian::JiraConnect::Serializers::AuthorEntity, Atlassian::JiraConnect::Serializers::BaseEntity, Atlassian::JiraConnect::Serializers::BuildEntity, Atlassian::JiraConnect::Serializers::DeploymentEntity, Atlassian::JiraConnect::Serializers::FeatureFlagEntity, Atlassian::JiraConnect::Serializers::FileEntity, Atlassian::JiraConnect::Serializers::PipelineEntity, Banzai::Filter::InlineAlertMetricsFilter, ChatNames::AuthorizeUserService, Ci::ExpirePipelineCacheService::UrlHelpers, Ci::FindExposedArtifactsService, Ci::TriggerEntity, Clusters::Integrations::PrometheusHealthCheckService, ContextCommitsDiffEntity, ErrorTracking::IssueDetailsService, ErrorTracking::ProjectErrorTrackingSetting, AlertManagement::Payload::Base, Ci::Badge::Metadata, Ci::Status::Core, Ci::Status::Stage::PlayManual, CodeNavigationPath, Conflict::File, Email::Message::BuildIosAppGuide, Email::Message::InProductMarketing::Base, Email::Message::RepositoryPush, SlashCommands::Presenters::Base, UrlBuilder, View::Presenter::Base, Integrations::Jira, Integrations::Zentao, IssuableLinks::ListService, IssuableSidebarTodoEntity, JiraConnect::AppDataSerializer, JiraConnect::SubscriptionEntity, MergeRequestDiffEntity, Mutations::Commits::Create::UrlHelpers, Projects::BranchesByModeService, Sidebars::Menu, Types::AlertManagement::PrometheusIntegrationType, WebIdeTerminal
Defined in:
lib/gitlab/routing.rb

Defined Under Namespace

Classes: LegacyRedirector

Class Method Summary collapse

Class Method Details

.add_helpers(mod) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/gitlab/routing.rb', line 50

def self.add_helpers(mod)
  url_helpers.include 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.include mod
  app_url_helpers.extend mod

  _includers.each do |klass|
    klass.include mod
  end
end

.includes_helpers(klass) ⇒ Object


46
47
48
# File 'lib/gitlab/routing.rb', line 46

def self.includes_helpers(klass)
  self._includers << klass
end

.redirect_legacy_paths(router, *paths) ⇒ Object


76
77
78
79
80
81
82
83
# File 'lib/gitlab/routing.rb', line 76

def self.redirect_legacy_paths(router, *paths)
  paths.each do |path|
    router.match "/#{path}(/*rest)",
                 via: [:get, :post, :patch, :delete],
                 to: router.redirect(LegacyRedirector.new(path)),
                 as: "legacy_#{path}_redirect"
  end
end

.url_helpersObject

Returns the URL helpers Module.

This method caches the output as Rails' “url_helpers” method creates an anonymous module every time it's called.

Returns a Module.


72
73
74
# File 'lib/gitlab/routing.rb', line 72

def self.url_helpers
  @url_helpers ||= Gitlab::Application.routes.url_helpers
end