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
Jérome Perrin
gitlab-ce
Commits
036ee515
Commit
036ee515
authored
Aug 07, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port form back to use form_tag
parent
1b8fb792
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
18 deletions
+12
-18
app/controllers/import/gitlab_projects_controller.rb
app/controllers/import/gitlab_projects_controller.rb
+1
-1
app/views/import/gitlab_projects/new.html.haml
app/views/import/gitlab_projects/new.html.haml
+9
-15
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+2
-2
No files found.
app/controllers/import/gitlab_projects_controller.rb
View file @
036ee515
...
@@ -12,7 +12,7 @@ class Import::GitlabProjectsController < Import::BaseController
...
@@ -12,7 +12,7 @@ class Import::GitlabProjectsController < Import::BaseController
return
redirect_back_or_default
(
options:
{
alert:
"You need to upload a GitLab project export archive."
})
return
redirect_back_or_default
(
options:
{
alert:
"You need to upload a GitLab project export archive."
})
end
end
@project
=
::
Projects
::
GitlabProjectsImport
er
Service
.
new
(
current_user
,
project_params
).
execute
@project
=
::
Projects
::
GitlabProjectsImportService
.
new
(
current_user
,
project_params
).
execute
if
@project
.
saved?
if
@project
.
saved?
redirect_to
(
redirect_to
(
...
...
app/views/import/gitlab_projects/new.html.haml
View file @
036ee515
...
@@ -8,29 +8,25 @@
...
@@ -8,29 +8,25 @@
Import an exported GitLab project
Import an exported GitLab project
%hr
%hr
=
form_
for
import_gitlab_project_path
,
html:
{
class:
'new_project'
},
multipart:
true
do
|
f
|
=
form_
tag
import_gitlab_project_path
,
html:
{
class:
'new_project'
},
multipart:
true
do
.row
.row
.form-group.col-xs-12.col-sm-6
.form-group.col-xs-12.col-sm-6
=
f
.
label
:namespace_id
,
class:
'label-light'
do
.span
%span
=
label_tag
:namespace_id
,
'Project path'
,
class:
'label-light'
Project path
.form-group
.form-group
.input-group
.input-group
-
if
current_user
.
can_select_namespace?
-
if
current_user
.
can_select_namespace?
.input-group-addon
.input-group-addon
=
root_url
=
root_url
=
f
.
select
:namespace_id
,
namespaces_options
(
namespace_id_from
(
params
)
||
:current_user
,
display_path:
true
,
extra_group:
namespace_id_from
(
params
)),
{},
{
class:
'select2 js-select-namespace'
,
tabindex:
1
}
=
select_tag
:namespace_id
,
namespaces_options
(
namespace_id_from
(
params
)
||
:current_user
,
display_path:
true
,
extra_group:
namespace_id_from
(
params
)),
class:
'select2 js-select-namespace'
,
tabindex:
1
-
else
-
else
.input-group-addon.static-namespace
.input-group-addon.static-namespace
#{
root_url
}#{
current_user
.
username
}
/
#{
root_url
}#{
current_user
.
username
}
/
=
f
.
hidden_field
:namespace_id
,
value:
current_user
.
namespace_id
=
hidden_field_tag
:namespace_id
,
value:
current_user
.
namespace_id
.form-group.col-xs-12.col-sm-6.project-path
.form-group.col-xs-12.col-sm-6.project-path
=
f
.
label
:path
,
class:
'label-light'
do
=
label_tag
:path
,
'Project name'
,
class:
'label-light'
%span
=
text_field_tag
:path
,
nil
,
placeholder:
"my-awesome-project"
,
class:
"js-path-name form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
Project name
=
f
.
text_field
:path
,
placeholder:
"my-awesome-project"
,
class:
"js-path-name form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
.row
.row
.form-group.col-md-12
.form-group.col-md-12
...
@@ -39,12 +35,10 @@
...
@@ -39,12 +35,10 @@
.form-group.col-sm-12
.form-group.col-sm-12
=
hidden_field_tag
:namespace_id
,
@namespace
.
id
=
hidden_field_tag
:namespace_id
,
@namespace
.
id
=
hidden_field_tag
:path
,
@path
=
hidden_field_tag
:path
,
@path
=
f
.
label
:file
,
class:
'label-light'
do
=
label_tag
:file
,
'GitLab project export'
,
class:
'label-light'
%span
GitLab project export
.form-group
.form-group
=
file_field_tag
:file
,
class:
''
=
file_field_tag
:file
,
class:
''
.row
.row
.form-actions
.form-actions
=
f
.
submit
'Import project'
,
class:
'btn btn-create'
=
submit_tag
'Import project'
,
class:
'btn btn-create'
=
link_to
'Cancel'
,
new_project_path
,
class:
'btn btn-cancel'
=
link_to
'Cancel'
,
new_project_path
,
class:
'btn btn-cancel'
spec/features/projects/import_export/import_file_spec.rb
View file @
036ee515
...
@@ -29,9 +29,9 @@ feature 'Import/Export - project import integration test', js: true do
...
@@ -29,9 +29,9 @@ feature 'Import/Export - project import integration test', js: true do
fill_in
:project_path
,
with:
'test-project-path'
,
visible:
true
fill_in
:project_path
,
with:
'test-project-path'
,
visible:
true
click_link
'GitLab export'
click_link
'GitLab export'
expect
(
page
).
to
have_content
(
'
GitLab project expor
t'
)
expect
(
page
).
to
have_content
(
'
Import an exported GitLab projec
t'
)
expect
(
URI
.
parse
(
current_url
).
query
).
to
eq
(
"namespace_id=
#{
namespace
.
id
}
&path=test-project-path"
)
expect
(
URI
.
parse
(
current_url
).
query
).
to
eq
(
"namespace_id=
#{
namespace
.
id
}
&path=test-project-path"
)
expect
(
Gitlab
::
ImportExport
).
to
receive
(
:import_upload_path
).
with
(
filename:
/\A
[0-9a-f]{32}_test_project_export\.tar\.gz
\z/
).
and_call_original
expect
(
Gitlab
::
ImportExport
).
to
receive
(
:import_upload_path
).
with
(
filename:
/\A
\h{32}_test-project-path
\z/
).
and_call_original
attach_file
(
'file'
,
file
)
attach_file
(
'file'
,
file
)
...
...
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