Module: Routing::ProjectsHelper

Included in:
GitlabRoutingHelper
Defined in:
app/helpers/routing/projects_helper.rb

Instance Method Summary collapse

Instance Method Details

#commit_url(entity, *args) ⇒ Object



68
69
70
# File 'app/helpers/routing/projects_helper.rb', line 68

def commit_url(entity, *args)
  project_commit_url(entity.project, entity.sha, *args)
end

#commits_url(entity, *args) ⇒ Object



64
65
66
# File 'app/helpers/routing/projects_helper.rb', line 64

def commits_url(entity, *args)
  project_commits_url(entity.project, entity.source_ref, *args)
end

#edit_milestone_path(entity, *args) ⇒ Object



76
77
78
79
80
81
82
# File 'app/helpers/routing/projects_helper.rb', line 76

def edit_milestone_path(entity, *args)
  if entity.resource_parent.is_a?(Group)
    edit_group_milestone_path(entity.resource_parent, entity, *args)
  else
    edit_project_milestone_path(entity.resource_parent, entity, *args)
  end
end

#environment_delete_path(environment, *args) ⇒ Object



21
22
23
# File 'app/helpers/routing/projects_helper.rb', line 21

def environment_delete_path(environment, *args)
  expose_path(api_v4_projects_environments_path(id: environment.project.id, environment_id: environment.id))
end

#environment_path(environment, *args) ⇒ Object



17
18
19
# File 'app/helpers/routing/projects_helper.rb', line 17

def environment_path(environment, *args)
  project_environment_path(environment.project, environment, *args)
end

#issue_path(entity, *args) ⇒ Object



33
34
35
36
37
38
39
# File 'app/helpers/routing/projects_helper.rb', line 33

def issue_path(entity, *args)
  if entity.use_work_item_url?
    project_work_item_path(entity.project, entity, *args)
  else
    project_issue_path(entity.project, entity, *args)
  end
end

#merge_request_path(entity, *args) ⇒ Object



25
26
27
# File 'app/helpers/routing/projects_helper.rb', line 25

def merge_request_path(entity, *args)
  project_merge_request_path(entity.project, entity, *args)
end

#merge_request_url(entity, *args) ⇒ Object



52
53
54
# File 'app/helpers/routing/projects_helper.rb', line 52

def merge_request_url(entity, *args)
  project_merge_request_url(entity.project, entity, *args)
end

#pipeline_job_url(pipeline, build, *args) ⇒ Object



60
61
62
# File 'app/helpers/routing/projects_helper.rb', line 60

def pipeline_job_url(pipeline, build, *args)
  project_job_url(pipeline.project, build.id, *args)
end

#pipeline_path(pipeline, *args) ⇒ Object



29
30
31
# File 'app/helpers/routing/projects_helper.rb', line 29

def pipeline_path(pipeline, *args)
  project_pipeline_path(pipeline.project, pipeline.id, *args)
end

#pipeline_url(pipeline, *args) ⇒ Object



56
57
58
# File 'app/helpers/routing/projects_helper.rb', line 56

def pipeline_url(pipeline, *args)
  project_pipeline_url(pipeline.project, pipeline.id, *args)
end

#project_commits_path(project, ref = nil, *args) ⇒ Object



9
10
11
# File 'app/helpers/routing/projects_helper.rb', line 9

def project_commits_path(project, ref = nil, *args)
  namespace_project_commits_path(project.namespace, project, ref || @ref || project.repository.root_ref, *args) # rubocop:disable Cop/ProjectPathHelper
end

#project_ref_path(project, ref_name, *args) ⇒ Object



13
14
15
# File 'app/helpers/routing/projects_helper.rb', line 13

def project_ref_path(project, ref_name, *args)
  project_commits_path(project, ref_name, *args)
end

#project_tree_path(project, ref = nil, *args) ⇒ Object



5
6
7
# File 'app/helpers/routing/projects_helper.rb', line 5

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
end

#release_url(entity, *args) ⇒ Object



72
73
74
# File 'app/helpers/routing/projects_helper.rb', line 72

def release_url(entity, *args)
  project_release_url(entity.project, entity, *args)
end

#toggle_subscription_path(entity, *args) ⇒ Object



84
85
86
87
88
89
90
# File 'app/helpers/routing/projects_helper.rb', line 84

def toggle_subscription_path(entity, *args)
  if entity.is_a?(Issue)
    toggle_subscription_project_issue_path(entity.project, entity)
  else
    toggle_subscription_project_merge_request_path(entity.project, entity)
  end
end

#work_item_url(entity, *args) ⇒ Object Also known as: issue_url



41
42
43
44
45
46
47
48
49
# File 'app/helpers/routing/projects_helper.rb', line 41

def work_item_url(entity, *args)
  return group_work_item_url(entity.namespace, entity.iid, *args) if entity.group_level?

  if entity.use_work_item_url?
    project_work_item_url(entity.project, entity.iid, *args)
  else
    project_issue_url(entity.project, entity.iid, *args)
  end
end