summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorEtienne BaquƩ <ebaque@gitlab.com>2019-09-10 07:28:43 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-09-10 07:28:43 +0000
commitb3b9a80dfe344f8e34e36a3d179e3fab1205208a (patch)
tree05a3c25d8d6603b92b86ab02eb7d524ec8bd4966 /app/helpers
parent8db75fec1dd375191a83379d36c8834163225426 (diff)
downloadgitlab-ce-b3b9a80dfe344f8e34e36a3d179e3fab1205208a.tar.gz
Provide urls for Merge Requests and Issue links
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/releases_helper.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/helpers/releases_helper.rb b/app/helpers/releases_helper.rb
new file mode 100644
index 00000000000..4d9fe345edf
--- /dev/null
+++ b/app/helpers/releases_helper.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+module ReleasesHelper
+ IMAGE_PATH = 'illustrations/releases.svg'
+ DOCUMENTATION_PATH = 'user/project/releases/index'
+
+ def illustration
+ image_path(IMAGE_PATH)
+ end
+
+ def help_page
+ help_page_path(DOCUMENTATION_PATH)
+ end
+
+ def url_for_merge_requests
+ project_merge_requests_url(@project, params_for_issue_and_mr_paths)
+ end
+
+ def url_for_issues
+ project_issues_url(@project, params_for_issue_and_mr_paths)
+ end
+
+ def data_for_releases_page
+ {
+ project_id: @project.id,
+ illustration_path: illustration,
+ documentation_path: help_page,
+ merge_requests_url: url_for_merge_requests,
+ issues_url: url_for_issues
+ }
+ end
+
+ private
+
+ def params_for_issue_and_mr_paths
+ { scope: 'all', state: 'opened' }
+ end
+end