Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-06-15 18:31:00 +0300
committerJames Lopez <james@jameslopez.es>2016-06-15 18:31:00 +0300
commit4bde59341f6d4679b2eefa2c5e332c33c3c76050 (patch)
treed9c98b030da720f0d413f6ad5e3066cb67559fdd /app/controllers
parentf6896f9381b9d833e0db4d0e5be95f2ffc64561a (diff)
lots of refactoring again based on feedback. Changed the UI slightly and also fixed a small bug
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/import/gitlab_projects_controller.rb7
-rw-r--r--app/controllers/projects_controller.rb31
2 files changed, 27 insertions, 11 deletions
diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb
index d63dd64b728..f99aa490d3e 100644
--- a/app/controllers/import/gitlab_projects_controller.rb
+++ b/app/controllers/import/gitlab_projects_controller.rb
@@ -3,6 +3,7 @@ class Import::GitlabProjectsController < Import::BaseController
def new
@namespace_id = project_params[:namespace_id]
+ @namespace_name = Namespace.find(project_params[:namespace_id]).name
@path = project_params[:path]
end
@@ -23,8 +24,8 @@ class Import::GitlabProjectsController < Import::BaseController
)
else
redirect_to(
- new_project_path,
- alert: "Project could not be exported: #{@project.errors.full_messages.join(', ')}"
+ new_import_gitlab_project_path,
+ alert: "Project could not be imported: #{@project.errors.full_messages.join(', ')}"
)
end
end
@@ -32,7 +33,7 @@ class Import::GitlabProjectsController < Import::BaseController
private
def file_is_valid?
- project_params[:file].respond_to?(:read)
+ project_params[:file] && project_params[:file].respond_to?(:read)
end
def verify_gitlab_project_import_enabled
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index affc298e0ca..af357ae9a71 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -7,7 +7,7 @@ class ProjectsController < Projects::ApplicationController
before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
# Authorize
- before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export]
+ before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export]
before_action :event_filter, only: [:show, :activity]
layout :determine_layout
@@ -186,19 +186,38 @@ class ProjectsController < Projects::ApplicationController
end
def export
- @project.add_export_job(current_user_id: current_user.id)
+ @project.add_export_job(current_user: current_user)
redirect_to(
edit_project_path(@project),
- notice: "Project export started."
+ notice: "Project export started. A download link will be sent by e-mail."
)
end
def download_export
+ export_project_path = @project.export_project_path
+
if export_project_path
send_file export_project_path, disposition: 'attachment'
else
- render_404
+ redirect_to(
+ edit_project_path(@project),
+ alert: "Project export link has expired. Please generate a new export from your project settings."
+ )
+ end
+ end
+
+ def remove_export
+ if @project.remove_exports
+ redirect_to(
+ edit_project_path(@project),
+ notice: "Project export has been deleted."
+ )
+ else
+ redirect_to(
+ edit_project_path(@project),
+ alert: "Project export could not be deleted."
+ )
end
end
@@ -264,8 +283,4 @@ class ProjectsController < Projects::ApplicationController
def get_id
project.repository.root_ref
end
-
- def export_project_path
- Dir.glob("#{@project.export_path}/*export.tar.gz").max_by {|f| File.ctime(f)}
- end
end