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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e028276d
Commit
e028276d
authored
Jul 13, 2018
by
Kia Mei Somabes
Committed by
Patrick Bajao
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add download directory in menu
Add subdirectory params for RepositoriesController#archive
parent
8b9da458
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
app/controllers/projects/repositories_controller.rb
app/controllers/projects/repositories_controller.rb
+1
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+8
-0
app/helpers/workhorse_helper.rb
app/helpers/workhorse_helper.rb
+1
-0
app/views/projects/buttons/_download.html.haml
app/views/projects/buttons/_download.html.haml
+7
-1
No files found.
app/controllers/projects/repositories_controller.rb
View file @
e028276d
...
@@ -23,7 +23,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
...
@@ -23,7 +23,7 @@ class Projects::RepositoriesController < Projects::ApplicationController
append_sha
=
false
if
@filename
==
shortname
append_sha
=
false
if
@filename
==
shortname
end
end
send_git_archive
@repository
,
ref:
@ref
,
format:
params
[
:format
],
append_sha:
append_sha
send_git_archive
@repository
,
ref:
@ref
,
subdirectory:
params
[
:subdirectory
],
format:
params
[
:format
],
append_sha:
append_sha
rescue
=>
ex
rescue
=>
ex
logger
.
error
(
"
#{
self
.
class
.
name
}
:
#{
ex
}
"
)
logger
.
error
(
"
#{
self
.
class
.
name
}
:
#{
ex
}
"
)
git_not_found!
git_not_found!
...
...
app/helpers/projects_helper.rb
View file @
e028276d
...
@@ -26,6 +26,14 @@ module ProjectsHelper
...
@@ -26,6 +26,14 @@ module ProjectsHelper
image_tag
(
src
,
width:
opts
[
:size
],
class:
classes
,
alt:
''
,
"data-src"
=>
avatar
)
image_tag
(
src
,
width:
opts
[
:size
],
class:
classes
,
alt:
''
,
"data-src"
=>
avatar
)
end
end
def
is_directory
@path
.
empty?
?
false
:
true
end
def
get_directory_path
@path
?
"
#{
@path
}
/"
:
''
end
def
author_content_tag
(
author
,
opts
=
{})
def
author_content_tag
(
author
,
opts
=
{})
default_opts
=
{
author_class:
'author'
,
tooltip:
false
,
by_username:
false
}
default_opts
=
{
author_class:
'author'
,
tooltip:
false
,
by_username:
false
}
...
...
app/helpers/workhorse_helper.rb
View file @
e028276d
...
@@ -31,6 +31,7 @@ module WorkhorseHelper
...
@@ -31,6 +31,7 @@ module WorkhorseHelper
# Archive a Git repository and send it through Workhorse
# Archive a Git repository and send it through Workhorse
def
send_git_archive
(
repository
,
**
kwargs
)
def
send_git_archive
(
repository
,
**
kwargs
)
kwargs
.
delete
(
:subdirectory
)
if
kwargs
[
:subdirectory
].
nil?
headers
.
store
(
*
Gitlab
::
Workhorse
.
send_git_archive
(
repository
,
**
kwargs
))
headers
.
store
(
*
Gitlab
::
Workhorse
.
send_git_archive
(
repository
,
**
kwargs
))
head
:ok
head
:ok
end
end
...
...
app/views/projects/buttons/_download.html.haml
View file @
e028276d
...
@@ -8,8 +8,14 @@
...
@@ -8,8 +8,14 @@
%span
.sr-only
=
_
(
'Select Archive Format'
)
%span
.sr-only
=
_
(
'Select Archive Format'
)
=
sprite_icon
(
"arrow-down"
)
=
sprite_icon
(
"arrow-down"
)
%ul
.dropdown-menu.dropdown-menu-right
{
role:
'menu'
}
%ul
.dropdown-menu.dropdown-menu-right
{
role:
'menu'
}
-
if
is_directory
%li
.dropdown-header
#{
_
(
'Directory'
)
}
%li
=
link_to
project_archive_path
(
project
,
subdirectory:
get_directory_path
,
id:
tree_join
(
ref
,
archive_prefix
),
format:
'zip'
),
rel:
'nofollow'
,
download:
''
do
%span
=
_
(
'Download zip'
)
%li
.dropdown-header
%li
.dropdown-header
#{
_
(
'
Source code
'
)
}
#{
_
(
'
Repository
'
)
}
%li
%li
=
link_to
project_archive_path
(
project
,
id:
tree_join
(
ref
,
archive_prefix
),
format:
'zip'
),
rel:
'nofollow'
,
download:
''
do
=
link_to
project_archive_path
(
project
,
id:
tree_join
(
ref
,
archive_prefix
),
format:
'zip'
),
rel:
'nofollow'
,
download:
''
do
%span
=
_
(
'Download zip'
)
%span
=
_
(
'Download zip'
)
...
...
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