summaryrefslogtreecommitdiff
path: root/app/presenters/snippet_blob_presenter.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-18 12:10:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-18 12:10:16 +0000
commitf10eb9ebaefb0d6ff4ee7552dbf127dc70aaf27d (patch)
treeddf0000b12ccb57f3926785976c4ccd6eaf3aac3 /app/presenters/snippet_blob_presenter.rb
parent89eff770d213e684b5fa4df121cb51a059e8d263 (diff)
downloadgitlab-ce-f10eb9ebaefb0d6ff4ee7552dbf127dc70aaf27d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters/snippet_blob_presenter.rb')
-rw-r--r--app/presenters/snippet_blob_presenter.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/presenters/snippet_blob_presenter.rb b/app/presenters/snippet_blob_presenter.rb
index 6557e3a4414..abe95f5c44d 100644
--- a/app/presenters/snippet_blob_presenter.rb
+++ b/app/presenters/snippet_blob_presenter.rb
@@ -4,7 +4,6 @@ class SnippetBlobPresenter < BlobPresenter
include GitlabRoutingHelper
def rich_data
- return if blob.binary?
return unless blob.rich_viewer
render_rich_partial
@@ -17,9 +16,11 @@ class SnippetBlobPresenter < BlobPresenter
end
def raw_path
- return gitlab_raw_snippet_blob_path(snippet, blob.path) if snippet_multiple_files?
+ snippet_blob_raw_route(only_path: true)
+ end
- gitlab_raw_snippet_path(snippet)
+ def raw_url
+ snippet_blob_raw_route
end
private
@@ -38,7 +39,7 @@ class SnippetBlobPresenter < BlobPresenter
def render_rich_partial
renderer.render("projects/blob/viewers/_#{blob.rich_viewer.partial_name}",
- locals: { viewer: blob.rich_viewer, blob: blob, blob_raw_path: raw_path },
+ locals: { viewer: blob.rich_viewer, blob: blob, blob_raw_path: raw_path, blob_raw_url: raw_url },
layout: false)
end
@@ -49,4 +50,10 @@ class SnippetBlobPresenter < BlobPresenter
ApplicationController.renderer.new('warden' => proxy)
end
+
+ def snippet_blob_raw_route(only_path: false)
+ return gitlab_raw_snippet_blob_url(snippet, blob.path, only_path: only_path) if snippet_multiple_files?
+
+ gitlab_raw_snippet_url(snippet, only_path: only_path)
+ end
end