Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
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
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+4
-4
app/helpers/snippets_helper.rb
app/helpers/snippets_helper.rb
+8
-0
app/views/shared/snippets/_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