Commit 97c72d74 authored by Jason Hollingsworth's avatar Jason Hollingsworth

Add UI for downloading various archive formats.

Change the “Download” button to a split button with options for zip and
tar.gz.
Added download option to tree view.
parent 1ad2a936
......@@ -143,16 +143,27 @@
line-height: 16px;
margin: 2px;
}
}
.btn-block {
width: 100%;
margin: 0;
margin-bottom: 15px;
&.btn {
padding: 6px 0;
}
}
.btn,
.btn-group {
&.grouped {
margin-right: 7px;
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,6 +228,9 @@ ul.nav.nav-projects-tabs {
.project-side {
.btn-block {
background-image: none;
.btn,
&.btn,
&.btn-group ul.dropdown-menu {
background-color: #F1f1f1;
border-color: #EEE;
&:hover {
......@@ -235,6 +238,18 @@ ul.nav.nav-projects-tabs {
border-color: #DDD;
}
}
&.btn-group-justified {
.btn {
width: 100%;
}
.dropdown-toggle {
width: 26px;
}
}
ul {
width: 100%;
}
}
.project-fork-icon {
float: left;
font-size: 26px;
......
......@@ -10,9 +10,7 @@
%i.icon-lock
.pull-right
- if can?(current_user, :download_code, @project)
= link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do
%i.icon-download-alt
Download
= render 'projects/repositories/download_archive', ref: branch.name, btn_class: 'grouped btn-group-small'
= link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do
%i.icon-copy
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,9 +34,8 @@
Fork repository
- if can? current_user, :download_code, @project
= link_to archive_project_repository_path(@project), class: "btn btn-block" do
%i.icon-download-alt
%span Download
= render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
Compare code
......
......@@ -32,11 +32,9 @@
%span.pull-right
- if can? current_user, :download_code, @project
= link_to archive_project_repository_path(@project, ref: tag.name), class: 'btn grouped btn-small' do
%i.icon-download-alt
Download
= render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'grouped btn-group-small'
- 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
= paginate @tags, theme: 'gitlab'
......
%div.tree-ref-holder
= 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
= 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