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:
-rw-r--r--app/controllers/import/gitlab_projects_controller.rb9
-rw-r--r--app/views/import/gitlab_projects/new.html.haml3
-rw-r--r--app/views/projects/new.html.haml6
3 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/import/gitlab_projects_controller.rb b/app/controllers/import/gitlab_projects_controller.rb
index 36be79a39c4..b141b5f472a 100644
--- a/app/controllers/import/gitlab_projects_controller.rb
+++ b/app/controllers/import/gitlab_projects_controller.rb
@@ -27,15 +27,18 @@ class Import::GitlabProjectsController < Import::BaseController
end
def create
+ # TODO verify access to namespace and path
file = params[:file]
+ namespace_id = project_params[:namespace_id]
+ path = project_params[:path]
repo_owner = current_user.username
@target_namespace = params[:new_namespace].presence || repo_owner
@project = Project.create_from_import_job(current_user_id: current_user.id,
tmp_file: File.expand_path(file.path),
- namespace_id: @namespace_id,
- project_path: @path)
+ namespace_id: namespace_id,
+ project_path: path)
end
private
@@ -45,7 +48,7 @@ class Import::GitlabProjectsController < Import::BaseController
end
def project_params
- params.require(:project).permit(
+ params.permit(
:path, :namespace_id,
)
end
diff --git a/app/views/import/gitlab_projects/new.html.haml b/app/views/import/gitlab_projects/new.html.haml
index 323b7810c59..1158a04ea46 100644
--- a/app/views/import/gitlab_projects/new.html.haml
+++ b/app/views/import/gitlab_projects/new.html.haml
@@ -9,9 +9,12 @@
%p
To get started you add your project export file below.
.form-group
+ = hidden_field_tag :namespace_id, @namespace_id
+ = hidden_field_tag :path, @path
= label_tag :file, class: 'control-label' do
%span GitLab export file
.col-sm-10
= file_field_tag :file, class: ''
+
.form-actions
= submit_tag 'Continue to the next step', class: 'btn btn-create'
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index d4bb57aafc7..b3d755b3790 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -91,7 +91,7 @@
%span Repo by URL
- if gitlab_project_import_enabled?
- = link_to new_import_gitlab_project_path, class: 'btn import_gitlab_project' do
+ = link_to new_import_gitlab_project_path, class: 'btn import_gitlab_project project-submit' do
%i.fa.fa-gitlab
%span GitLab project
@@ -127,3 +127,7 @@
$('.modal-header .close').bind('click', function() {
$(".modal").hide();
});
+ $('.import_gitlab_project').bind('click', function() {
+ var _href = $("a.import_gitlab_project").attr("href");
+ $(".import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val());
+ });