summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-06-05 15:44:53 +0000
committerNick Thomas <nick@gitlab.com>2019-06-05 15:44:53 +0000
commit327c7d5a07fa08276a52b6a2bfdf79eee812a2cd (patch)
tree0da14d9a65451f5c1937fb8679cab3ab9f4c7954 /app/presenters
parent86ff32da666c8d284ecff5987d42fa4dfed2ee9b (diff)
parent4644a2daf5ec5e86e2b2989f04e99e4f081f6fef (diff)
downloadgitlab-ce-327c7d5a07fa08276a52b6a2bfdf79eee812a2cd.tar.gz
Merge branch 'graphql-file-entry-url' into 'master'
Add web_url to tree entry in GraphQL API See merge request gitlab-org/gitlab-ce!28646
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/blob_presenter.rb4
-rw-r--r--app/presenters/tree_entry_presenter.rb9
2 files changed, 13 insertions, 0 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb
index 6323c1b3389..c5675ef3ea3 100644
--- a/app/presenters/blob_presenter.rb
+++ b/app/presenters/blob_presenter.rb
@@ -13,4 +13,8 @@ class BlobPresenter < Gitlab::View::Presenter::Simple
plain: plain
)
end
+
+ def web_url
+ Gitlab::Routing.url_helpers.project_blob_url(blob.repository.project, File.join(blob.commit_id, blob.path))
+ end
end
diff --git a/app/presenters/tree_entry_presenter.rb b/app/presenters/tree_entry_presenter.rb
new file mode 100644
index 00000000000..7bb10cd1455
--- /dev/null
+++ b/app/presenters/tree_entry_presenter.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class TreeEntryPresenter < Gitlab::View::Presenter::Delegated
+ presents :tree
+
+ def web_url
+ Gitlab::Routing.url_helpers.project_tree_url(tree.repository.project, File.join(tree.commit_id, tree.path))
+ end
+end