diff options
author | Jason Hollingsworth <jhworth.developer@gmail.com> | 2014-01-02 10:31:25 -0600 |
---|---|---|
committer | Jason Hollingsworth <jhworth.developer@gmail.com> | 2014-01-07 20:50:36 -0600 |
commit | 97c72d7417ab766b37c745cbdcbc8cedab986362 (patch) | |
tree | 0659f6e71258ad9de6a3e1ae6ff2adbd9706e218 /app/views/projects | |
parent | 1ad2a93678c3a513fcc6ba575343c0b1d93a16f0 (diff) | |
download | gitlab-ce-97c72d7417ab766b37c745cbdcbc8cedab986362.tar.gz |
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.
Diffstat (limited to 'app/views/projects')
-rw-r--r-- | app/views/projects/branches/_branch.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/repositories/_download_archive.html.haml | 37 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/tags/index.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/tree/show.html.haml | 3 |
5 files changed, 47 insertions, 12 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 2bd39985107..4fd708517fc 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -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 diff --git a/app/views/projects/repositories/_download_archive.html.haml b/app/views/projects/repositories/_download_archive.html.haml new file mode 100644 index 00000000000..b03feded0a7 --- /dev/null +++ b/app/views/projects/repositories/_download_archive.html.haml @@ -0,0 +1,37 @@ +- 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 diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index e188d365903..59075abf984 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -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 diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index 945853c726b..c88e42a1073 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -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' diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 0f7692aba7f..60ae95ebcb7 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -1,4 +1,7 @@ %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 |