diff options
author | James Lopez <james@jameslopez.es> | 2016-04-15 15:38:34 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-04-15 15:38:34 +0200 |
commit | 05edd5e6dc169e4987e5e98e9243fa85c5b6e4b8 (patch) | |
tree | 4b7fcd7e22b91888af929940d95e0ae624ed8cde | |
parent | 41163fd55251edbfa0d0dd341e34c878563e4981 (diff) | |
download | gitlab-ce-05edd5e6dc169e4987e5e98e9243fa85c5b6e4b8.tar.gz |
download export now working
-rw-r--r-- | app/controllers/projects_controller.rb | 11 | ||||
-rw-r--r-- | app/views/projects/edit.html.haml | 7 | ||||
-rw-r--r-- | config/routes.rb | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 39ae3659a82..9fb4370ef90 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -190,11 +190,15 @@ class ProjectsController < Projects::ApplicationController ::Projects::ImportExport::ExportService.new(@project, current_user).execute redirect_to( - project_path(@project), + edit_project_path(@project), notice: "Project export successfully started" ) end + def download_export + send_file export_project_path, disposition: 'attachment' + end + def toggle_star current_user.toggle_star(@project) @project.reload @@ -256,4 +260,9 @@ class ProjectsController < Projects::ApplicationController def get_id project.repository.root_ref end + + def export_project_path + # TODO: move this, probably to ImportExport and refactor + File.join(Settings.shared['path'], 'tmp/project_exports', @project.path_with_namespace, 'project.tar.gz') + end end diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 8097ef5d889..37ac0aa1f58 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -133,7 +133,7 @@ method: :post, class: "btn btn-default" .panel.panel-default - .panel-heading Export + .panel-heading Export project .errors-holder .panel-body %p @@ -141,9 +141,12 @@ %br .form-actions - = link_to 'Export', export_namespace_project_path(@project.namespace, @project), + = link_to 'Generate new export', export_namespace_project_path(@project.namespace, @project), method: :post, class: "btn btn-default" + = link_to 'Download export', download_export_namespace_project_path(@project.namespace, @project), + method: :post, class: "btn btn-default" + - if can? current_user, :archive_project, @project - if @project.archived? diff --git a/config/routes.rb b/config/routes.rb index 55d3084ed67..21164ba0eda 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -434,6 +434,7 @@ Rails.application.routes.draw do post :toggle_star post :markdown_preview post :export + post :download_export get :autocomplete_sources get :activity end |