Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
34c826a3
Commit
34c826a3
authored
Apr 27, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some JS magic to pass namespace and path importing projects
parent
cbbc42e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
app/controllers/import/gitlab_projects_controller.rb
app/controllers/import/gitlab_projects_controller.rb
+6
-3
app/views/import/gitlab_projects/new.html.haml
app/views/import/gitlab_projects/new.html.haml
+3
-0
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+5
-1
No files found.
app/controllers/import/gitlab_projects_controller.rb
View file @
34c826a3
...
@@ -27,15 +27,18 @@ class Import::GitlabProjectsController < Import::BaseController
...
@@ -27,15 +27,18 @@ class Import::GitlabProjectsController < Import::BaseController
end
end
def
create
def
create
# TODO verify access to namespace and path
file
=
params
[
:file
]
file
=
params
[
:file
]
namespace_id
=
project_params
[
:namespace_id
]
path
=
project_params
[
:path
]
repo_owner
=
current_user
.
username
repo_owner
=
current_user
.
username
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
@project
=
Project
.
create_from_import_job
(
current_user_id:
current_user
.
id
,
@project
=
Project
.
create_from_import_job
(
current_user_id:
current_user
.
id
,
tmp_file:
File
.
expand_path
(
file
.
path
),
tmp_file:
File
.
expand_path
(
file
.
path
),
namespace_id:
@
namespace_id
,
namespace_id:
namespace_id
,
project_path:
@
path
)
project_path:
path
)
end
end
private
private
...
@@ -45,7 +48,7 @@ class Import::GitlabProjectsController < Import::BaseController
...
@@ -45,7 +48,7 @@ class Import::GitlabProjectsController < Import::BaseController
end
end
def
project_params
def
project_params
params
.
require
(
:project
).
permit
(
params
.
permit
(
:path
,
:namespace_id
,
:path
,
:namespace_id
,
)
)
end
end
...
...
app/views/import/gitlab_projects/new.html.haml
View file @
34c826a3
...
@@ -9,9 +9,12 @@
...
@@ -9,9 +9,12 @@
%p
%p
To get started you add your project export file below.
To get started you add your project export file below.
.form-group
.form-group
=
hidden_field_tag
:namespace_id
,
@namespace_id
=
hidden_field_tag
:path
,
@path
=
label_tag
:file
,
class:
'control-label'
do
=
label_tag
:file
,
class:
'control-label'
do
%span
GitLab export file
%span
GitLab export file
.col-sm-10
.col-sm-10
=
file_field_tag
:file
,
class:
''
=
file_field_tag
:file
,
class:
''
.form-actions
.form-actions
=
submit_tag
'Continue to the next step'
,
class:
'btn btn-create'
=
submit_tag
'Continue to the next step'
,
class:
'btn btn-create'
app/views/projects/new.html.haml
View file @
34c826a3
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
%span
Repo by URL
%span
Repo by URL
-
if
gitlab_project_import_enabled?
-
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
%i
.fa.fa-gitlab
%span
GitLab project
%span
GitLab project
...
@@ -127,3 +127,7 @@
...
@@ -127,3 +127,7 @@
$
(
'
.modal-header .close
'
).
bind
(
'
click
'
,
function
()
{
$
(
'
.modal-header .close
'
).
bind
(
'
click
'
,
function
()
{
$
(
"
.modal
"
).
hide
();
$
(
"
.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
());
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment