BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0ca6ff67
Commit
0ca6ff67
authored
May 02, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add download_snippet_path helper
parent
2b3fc5e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
blob_helper.rb
app/helpers/blob_helper.rb
+4
-4
snippets_helper.rb
app/helpers/snippets_helper.rb
+8
-0
_blob.html.haml
app/views/shared/snippets/_blob.html.haml
+1
-1
No files found.
app/helpers/blob_helper.rb
View file @
0ca6ff67
...
...
@@ -118,15 +118,15 @@ module BlobHelper
icon
(
"
#{
file_type_icon_class
(
'file'
,
mode
,
name
)
}
fw"
)
end
def
blob_raw_url
(
params
=
{})
def
blob_raw_url
if
@snippet
if
@snippet
.
project_id
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
,
params
)
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
@snippet
)
else
raw_snippet_path
(
@snippet
,
params
)
raw_snippet_path
(
@snippet
)
end
elsif
@blob
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
,
params
)
namespace_project_raw_path
(
@project
.
namespace
,
@project
,
@id
)
end
end
...
...
app/helpers/snippets_helper.rb
View file @
0ca6ff67
...
...
@@ -8,6 +8,14 @@ module SnippetsHelper
end
end
def
download_snippet_path
(
snippet
)
if
snippet
.
project_id
raw_namespace_project_snippet_path
(
@project
.
namespace
,
@project
,
snippet
,
inline:
false
)
else
raw_snippet_path
(
snippet
,
inline:
false
)
end
end
# Return the path of a snippets index for a user or for a project
#
# @returns String, path to snippet index
...
...
app/views/shared/snippets/_blob.html.haml
View file @
0ca6ff67
...
...
@@ -18,6 +18,6 @@
=
copy_blob_source_button
(
blob
)
=
open_raw_blob_button
(
blob
)
=
link_to
icon
(
'download'
),
blob_raw_url
(
inline:
false
),
target:
'_blank'
,
class:
"btn btn-sm has-tooltip"
,
title:
'Download'
,
data:
{
container:
'body'
}
=
link_to
icon
(
'download'
),
download_snippet_path
(
@snippet
),
target:
'_blank'
,
class:
"btn btn-sm has-tooltip"
,
title:
'Download'
,
data:
{
container:
'body'
}
=
render
'projects/blob/content'
,
blob:
blob
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment