Commit 18fac5879d0228f501bea6316a5fbb955859fec3
Exists in
spb-stable
and in
3 other branches
Merge pull request #5969 from jhollingsworth/feature/zip-archive-ui
Add UI for downloading various archive formats.
Showing
7 changed files
with
85 additions
and
24 deletions
Show diff stats
app/assets/stylesheets/generic/buttons.scss
@@ -143,16 +143,27 @@ | @@ -143,16 +143,27 @@ | ||
143 | line-height: 16px; | 143 | line-height: 16px; |
144 | margin: 2px; | 144 | margin: 2px; |
145 | } | 145 | } |
146 | +} | ||
147 | + | ||
148 | +.btn-block { | ||
149 | + width: 100%; | ||
150 | + margin: 0; | ||
151 | + margin-bottom: 15px; | ||
152 | + &.btn { | ||
153 | + padding: 6px 0; | ||
154 | + } | ||
155 | +} | ||
146 | 156 | ||
157 | +.btn, | ||
158 | +.btn-group { | ||
147 | &.grouped { | 159 | &.grouped { |
148 | margin-right: 7px; | 160 | margin-right: 7px; |
149 | float: left; | 161 | float: left; |
150 | - } | ||
151 | - | ||
152 | - &.btn-block { | ||
153 | - width: 100%; | ||
154 | - margin: 0; | ||
155 | - padding: 6px 0; | ||
156 | - margin-bottom: 15px; | 162 | + &:last-child { |
163 | + margin-right: 0px; | ||
164 | + } | ||
157 | } | 165 | } |
158 | } | 166 | } |
167 | + | ||
168 | +.btn-group-small > .btn { @extend .btn.btn-small; } | ||
169 | +.btn-group-tiny > .btn { @extend .btn.btn-tiny; } |
app/assets/stylesheets/sections/projects.scss
@@ -228,11 +228,26 @@ ul.nav.nav-projects-tabs { | @@ -228,11 +228,26 @@ ul.nav.nav-projects-tabs { | ||
228 | .project-side { | 228 | .project-side { |
229 | .btn-block { | 229 | .btn-block { |
230 | background-image: none; | 230 | background-image: none; |
231 | - background-color: #F1f1f1; | ||
232 | - border-color: #EEE; | ||
233 | - &:hover { | ||
234 | - background-color: #eee; | ||
235 | - border-color: #DDD; | 231 | + .btn, |
232 | + &.btn, | ||
233 | + &.btn-group ul.dropdown-menu { | ||
234 | + background-color: #F1f1f1; | ||
235 | + border-color: #EEE; | ||
236 | + &:hover { | ||
237 | + background-color: #eee; | ||
238 | + border-color: #DDD; | ||
239 | + } | ||
240 | + } | ||
241 | + &.btn-group-justified { | ||
242 | + .btn { | ||
243 | + width: 100%; | ||
244 | + } | ||
245 | + .dropdown-toggle { | ||
246 | + width: 26px; | ||
247 | + } | ||
248 | + } | ||
249 | + ul { | ||
250 | + width: 100%; | ||
236 | } | 251 | } |
237 | } | 252 | } |
238 | .project-fork-icon { | 253 | .project-fork-icon { |
app/views/projects/branches/_branch.html.haml
@@ -10,9 +10,7 @@ | @@ -10,9 +10,7 @@ | ||
10 | %i.icon-lock | 10 | %i.icon-lock |
11 | .pull-right | 11 | .pull-right |
12 | - if can?(current_user, :download_code, @project) | 12 | - if can?(current_user, :download_code, @project) |
13 | - = link_to archive_project_repository_path(@project, ref: branch.name), class: 'btn grouped btn-small' do | ||
14 | - %i.icon-download-alt | ||
15 | - Download | 13 | + = render 'projects/repositories/download_archive', ref: branch.name, btn_class: 'grouped btn-group-small' |
16 | = link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do | 14 | = link_to project_compare_index_path(@project, from: branch.name, to: branch.name), class: 'btn grouped btn-small', title: "Compare" do |
17 | %i.icon-copy | 15 | %i.icon-copy |
18 | Compare | 16 | Compare |
app/views/projects/repositories/_download_archive.html.haml
0 → 100644
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +- ref = ref || nil | ||
2 | +- btn_class = btn_class || '' | ||
3 | +- split_button = split_button || false | ||
4 | +- if split_button == true | ||
5 | + %span.btn-group{class: btn_class} | ||
6 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'zip'), class: 'btn' do | ||
7 | + %i.icon-download-alt | ||
8 | + %span Download zip | ||
9 | + %a.btn.dropdown-toggle{ 'data-toggle' => 'dropdown' } | ||
10 | + %span.caret | ||
11 | + %span.sr-only | ||
12 | + Select Archive Format | ||
13 | + %ul.dropdown-menu{ role: 'menu' } | ||
14 | + %li | ||
15 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'zip') do | ||
16 | + %i.icon-download-alt | ||
17 | + %span Download zip | ||
18 | + %li | ||
19 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'tar.gz') do | ||
20 | + %i.icon-download-alt | ||
21 | + %span Download tar.gz | ||
22 | + %li | ||
23 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'tar.bz2') do | ||
24 | + %i.icon-download-alt | ||
25 | + %span Download tar.bz2 | ||
26 | + %li | ||
27 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'tar') do | ||
28 | + %i.icon-download-alt | ||
29 | + %span Download tar | ||
30 | +- else | ||
31 | + %span.btn-group{class: btn_class} | ||
32 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'zip'), class: 'btn' do | ||
33 | + %i.icon-download-alt | ||
34 | + %span zip | ||
35 | + = link_to archive_project_repository_path(@project, ref: ref, format: 'tar.gz'), class: 'btn' do | ||
36 | + %i.icon-download-alt | ||
37 | + %span tar.gz | ||
0 | \ No newline at end of file | 38 | \ No newline at end of file |
app/views/projects/show.html.haml
@@ -34,11 +34,10 @@ | @@ -34,11 +34,10 @@ | ||
34 | Fork repository | 34 | Fork repository |
35 | 35 | ||
36 | - if can? current_user, :download_code, @project | 36 | - if can? current_user, :download_code, @project |
37 | - = link_to archive_project_repository_path(@project), class: "btn btn-block" do | ||
38 | - %i.icon-download-alt | ||
39 | - %span Download | ||
40 | - = link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do | ||
41 | - Compare code | 37 | + = render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true |
38 | + | ||
39 | + = link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do | ||
40 | + Compare code | ||
42 | 41 | ||
43 | - if @repository.readme | 42 | - if @repository.readme |
44 | - readme = @repository.readme | 43 | - readme = @repository.readme |
app/views/projects/tags/index.html.haml
@@ -32,11 +32,9 @@ | @@ -32,11 +32,9 @@ | ||
32 | 32 | ||
33 | %span.pull-right | 33 | %span.pull-right |
34 | - if can? current_user, :download_code, @project | 34 | - if can? current_user, :download_code, @project |
35 | - = link_to archive_project_repository_path(@project, ref: tag.name), class: 'btn grouped btn-small' do | ||
36 | - %i.icon-download-alt | ||
37 | - Download | 35 | + = render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'grouped btn-group-small' |
38 | - if can?(current_user, :admin_project, @project) | 36 | - if can?(current_user, :admin_project, @project) |
39 | - = 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 | 37 | + = 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 |
40 | %i.icon-trash | 38 | %i.icon-trash |
41 | 39 | ||
42 | = paginate @tags, theme: 'gitlab' | 40 | = paginate @tags, theme: 'gitlab' |
app/views/projects/tree/show.html.haml
1 | %div.tree-ref-holder | 1 | %div.tree-ref-holder |
2 | = render 'shared/ref_switcher', destination: 'tree', path: @path | 2 | = render 'shared/ref_switcher', destination: 'tree', path: @path |
3 | +- if can? current_user, :download_code, @project | ||
4 | + .tree-ref-holder.pull-right | ||
5 | + = render 'projects/repositories/download_archive', ref: @ref, btn_class: 'btn-group-small', split_button: true | ||
3 | %div#tree-holder.tree-holder | 6 | %div#tree-holder.tree-holder |
4 | = render "tree", tree: @tree | 7 | = render "tree", tree: @tree |