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



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

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

#commits_url(entity, *args) ⇒ Object



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

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

#edit_milestone_path(entity, *args) ⇒ Object



79
80
81
82
83
84
85
# File 'app/helpers/routing/projects_helper.rb', line 79

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



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

def issue_path(entity, *args)
  project_issue_path(entity.project, entity, *args)
end

#issue_url(entity, *args) ⇒ Object



37
38
39
40
41
42
43
# File 'app/helpers/routing/projects_helper.rb', line 37

def issue_url(entity, *args)
  if use_work_items_path?(entity)
    work_item_url(entity, *args)
  else
    project_issue_url(entity.project, entity, *args)
  end
end

#merge_request_path(entity, *args) ⇒ Object



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

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

#merge_request_url(entity, *args) ⇒ Object



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

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

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



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

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

#pipeline_path(pipeline, *args) ⇒ Object



33
34
35
# File 'app/helpers/routing/projects_helper.rb', line 33

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

#pipeline_url(pipeline, *args) ⇒ Object



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

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



75
76
77
# File 'app/helpers/routing/projects_helper.rb', line 75

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

#toggle_subscription_path(entity, *args) ⇒ Object



87
88
89
90
91
92
93
# File 'app/helpers/routing/projects_helper.rb', line 87

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



45
46
47
48
49
50
51
52
53
# File 'app/helpers/routing/projects_helper.rb', line 45

def work_item_url(entity, *args)
  return group_work_item_url(entity.namespace, entity.iid, *args) unless entity.project.present?

  if use_issue_path?(entity)
    project_issue_url(entity.project, entity.iid, *args)
  else
    project_work_items_url(entity.project, entity.iid, *args)
  end
end