Commit 86d59080 authored by Jason Hollingsworth's avatar Jason Hollingsworth
Browse files

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 8bba95db9c5c
......@@ -143,4 +143,5 @@
line-height: 16px;
margin: 2px;
}
}
......@@ -146,4 +147,15 @@
.btn-block {
width: 100%;
margin: 0;
margin-bottom: 15px;
&.btn {
padding: 6px 0;
}
}
.btn,
.btn-group {
&.grouped {
margin-right: 7px;
float: left;
......@@ -147,12 +159,8 @@
&.grouped {
margin-right: 7px;
float: left;
}
&.btn-block {
width: 100%;
margin: 0;
padding: 6px 0;
margin-bottom: 15px;
&:last-child {
margin-right: 0px;
}
}
}
......@@ -157,2 +165,5 @@
}
}
.btn-group-small > .btn { @extend .btn.btn-small; }
.btn-group-tiny > .btn { @extend .btn.btn-tiny; }
......@@ -228,11 +228,26 @@
.project-side {
.btn-block {
background-image: none;
background-color: #F1f1f1;
border-color: #EEE;
&:hover {
background-color: #eee;
border-color: #DDD;
.btn,
&.btn,
&.btn-group ul.dropdown-menu {
background-color: #F1f1f1;
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 {
......
......@@ -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,11 +34,10 @@
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
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
Compare code
= 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
- if @repository.readme
- readme = @repository.readme
......
......@@ -32,7 +32,5 @@
%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)
......@@ -38,5 +36,5 @@
- 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
Supports Markdown
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