Commit 18fac587 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #5969 from jhollingsworth/feature/zip-archive-ui

Add UI for downloading various archive formats.
parents 1ad2a936 97c72d74
...@@ -143,16 +143,27 @@ ...@@ -143,16 +143,27 @@
line-height: 16px; line-height: 16px;
margin: 2px; margin: 2px;
} }
}
.btn-block {
width: 100%;
margin: 0;
margin-bottom: 15px;
&.btn {
padding: 6px 0;
}
}
.btn,
.btn-group {
&.grouped { &.grouped {
margin-right: 7px; margin-right: 7px;
float: left; float: left;
} &:last-child {
margin-right: 0px;
&.btn-block { }
width: 100%;
margin: 0;
padding: 6px 0;
margin-bottom: 15px;
} }
} }
.btn-group-small > .btn { @extend .btn.btn-small; }
.btn-group-tiny > .btn { @extend .btn.btn-tiny; }
...@@ -228,11 +228,26 @@ ul.nav.nav-projects-tabs { ...@@ -228,11 +228,26 @@ ul.nav.nav-projects-tabs {
.project-side { .project-side {
.btn-block { .btn-block {
background-image: none; background-image: none;
background-color: #F1f1f1; .btn,
border-color: #EEE; &.btn,
&:hover { &.btn-group ul.dropdown-menu {
background-color: #eee; background-color: #F1f1f1;
border-color: #DDD; border-color: #EEE;
&:hover {
background-color: #eee;
border-color: #DDD;
}
}
&.btn-group-justified {
.btn {
width: 100%;
}
.dropdown-toggle {
width: 26px;
}
}
ul {
width: 100%;
} }
} }
.project-fork-icon { .project-fork-icon {
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
%i.icon-lock %i.icon-lock
.pull-right .pull-right
- if can?(current_user, :download_code, @project) - if can?(current_user, :download_code, @project)
= link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do = render 'projects/repositories/download_archive', ref: branch.name, btn_class: 'grouped btn-group-small'
%i.icon-download-alt
Download
= link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do = link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do
%i.icon-copy %i.icon-copy
Compare Compare
......
- ref = ref || nil
- btn_class = btn_class || ''
- split_button = split_button || false
- if split_button == true
%span.btn-group{class: btn_class}
= link_to archive_project_repository_path(@project, ref: ref, format: 'zip'), class: 'btn' do
%i.icon-download-alt
%span Download zip
%a.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' }
%span.caret
%span.sr-only
Select Archive Format
%ul.dropdown-menu{ role: 'menu' }
%li
= link_to archive_project_repository_path(@project, ref: ref, format: 'zip') do
%i.icon-download-alt
%span Download zip
%li
= link_to archive_project_repository_path(@project, ref: ref, format: 'tar.gz') do
%i.icon-download-alt
%span Download tar.gz
%li
= link_to archive_project_repository_path(@project, ref: ref, format: 'tar.bz2') do
%i.icon-download-alt
%span Download tar.bz2
%li
= link_to archive_project_repository_path(@project, ref: ref, format: 'tar') do
%i.icon-download-alt
%span Download tar
- else
%span.btn-group{class: btn_class}
= link_to archive_project_repository_path(@project, ref: ref, format: 'zip'), class: 'btn' do
%i.icon-download-alt
%span zip
= link_to archive_project_repository_path(@project, ref: ref, format: 'tar.gz'), class: 'btn' do
%i.icon-download-alt
%span tar.gz
\ No newline at end of file
...@@ -34,11 +34,10 @@ ...@@ -34,11 +34,10 @@
Fork repository Fork repository
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
= link_to archive_project_repository_path(@project), class: "btn btn-block" do = render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true
%i.icon-download-alt
%span Download = link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do Compare code
Compare code
- if @repository.readme - if @repository.readme
- readme = @repository.readme - readme = @repository.readme
......
...@@ -32,11 +32,9 @@ ...@@ -32,11 +32,9 @@
%span.pull-right %span.pull-right
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
= link_to archive_project_repository_path(@project, ref: tag.name), class: 'btn grouped btn-small' do = render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'grouped btn-group-small'
%i.icon-download-alt
Download
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
= link_to project_tag_path(@project, tag.name), class: 'btn btn-small remove-row', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do = link_to project_tag_path(@project, tag.name), class: 'btn btn-small remove-row grouped', method: :delete, data: { confirm: 'Removed tag cannot be restored. Are you sure?'}, remote: true do
%i.icon-trash %i.icon-trash
= paginate @tags, theme: 'gitlab' = paginate @tags, theme: 'gitlab'
......
%div.tree-ref-holder %div.tree-ref-holder
= render 'shared/ref_switcher', destination: 'tree', path: @path = render 'shared/ref_switcher', destination: 'tree', path: @path
- if can? current_user, :download_code, @project
.tree-ref-holder.pull-right
= render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small', split_button: true
%div#tree-holder.tree-holder %div#tree-holder.tree-holder
= render "tree", tree: @tree = render "tree", tree: @tree
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment