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
fbde5e33
Commit
fbde5e33
authored
May 16, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed some messages and refactored the project_edit class to a function
parent
42604d4c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
21 deletions
+14
-21
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-2
app/assets/javascripts/project_edit.js
app/assets/javascripts/project_edit.js
+7
-14
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+2
-2
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+1
-1
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+1
-1
No files found.
app/assets/javascripts/dispatcher.js
View file @
fbde5e33
...
...
@@ -40,7 +40,7 @@ import Group from './group';
import
GroupName
from
'
./group_name
'
;
import
GroupsList
from
'
./groups_list
'
;
import
ProjectsList
from
'
./projects_list
'
;
import
ProjectEdit
from
'
./project_edit
'
;
import
setup
ProjectEdit
from
'
./project_edit
'
;
import
MiniPipelineGraph
from
'
./mini_pipeline_graph_dropdown
'
;
import
BlobLinePermalinkUpdater
from
'
./blob/blob_line_permalink_updater
'
;
import
Landing
from
'
./landing
'
;
...
...
@@ -266,7 +266,7 @@ import ShortcutsBlob from './shortcuts_blob';
}
break
;
case
'
projects:edit
'
:
new
ProjectEdit
();
setup
ProjectEdit
();
break
;
case
'
projects:pipelines:builds
'
:
case
'
projects:pipelines:failures
'
:
...
...
app/assets/javascripts/project_edit.js
View file @
fbde5e33
export
default
class
ProjectEdit
{
constructor
()
{
this
.
transferForm
=
$
(
'
.js-project-transfer-form
'
);
this
.
selectNamespace
=
$
(
'
.js-project-transfer-form
'
).
find
(
'
.select2
'
);
export
default
function
setupProjectEdit
()
{
const
$transferForm
=
$
(
'
.js-project-transfer-form
'
);
const
$selectNamespace
=
$transferForm
.
find
(
'
.select2
'
);
this
.
selectNamespaceChangedWrapper
=
this
.
selectNamespaceChanged
.
bind
(
this
);
this
.
selectNamespace
.
on
(
'
change
'
,
this
.
selectNamespaceChangedWrapper
);
this
.
selectNamespaceChanged
();
}
selectNamespaceChanged
()
{
const
selectedNamespaceValue
=
this
.
selectNamespace
.
val
();
this
.
transferForm
.
find
(
'
:submit
'
).
prop
(
'
disabled
'
,
!
selectedNamespaceValue
);
}
$selectNamespace
.
on
(
'
change
'
,
()
=>
{
$transferForm
.
find
(
'
:submit
'
).
prop
(
'
disabled
'
,
!
$selectNamespace
.
val
());
});
$selectNamespace
.
trigger
(
'
change
'
);
}
app/services/projects/transfer_service.rb
View file @
fbde5e33
...
...
@@ -16,9 +16,9 @@ module Projects
transfer
(
project
,
new_namespace
)
else
error_message
=
if
new_namespace
.
blank?
'Please select a n
amespace to transfer the project to
'
'Please select a n
ew namespace for your project.
'
else
'Transfer failed, please contact an admin'
'Transfer failed, please contact an admin
.
'
end
project
.
errors
.
add
(
:new_namespace
,
error_message
)
false
...
...
app/views/projects/edit.html.haml
View file @
fbde5e33
...
...
@@ -253,7 +253,7 @@
=
form_for
([
@project
.
namespace
.
becomes
(
Namespace
),
@project
],
url:
transfer_namespace_project_path
(
@project
.
namespace
,
@project
),
method: :put
,
remote:
true
,
html:
{
class:
'js-project-transfer-form'
}
)
do
|
f
|
.form-group
=
label_tag
:new_namespace_id
,
nil
,
class:
'label-light'
do
%span
Select
namespace to transfer to
%span
Select
a new namespace
.form-group
=
select_tag
:new_namespace_id
,
namespaces_options
(
nil
),
include_blank:
true
,
class:
'select2'
%ul
...
...
spec/controllers/projects_controller_spec.rb
View file @
fbde5e33
...
...
@@ -266,7 +266,7 @@ describe ProjectsController do
expect
(
project
.
namespace
.
id
).
to
eq
(
old_namespace_id
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
flash
[
:alert
]).
to
eq
'Please select a n
amespace to transfer the project to
'
expect
(
flash
[
:alert
]).
to
eq
'Please select a n
ew namespace for your project.
'
end
end
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
fbde5e33
...
...
@@ -26,7 +26,7 @@ describe Projects::TransferService, services: true do
it
{
expect
(
@result
).
to
eq
false
}
it
{
expect
(
project
.
namespace
).
to
eq
(
user
.
namespace
)
}
it
{
expect
(
project
.
errors
.
messages
[
:new_namespace
][
0
]).
to
eq
'Please select a n
amespace to transfer the project to
'
}
it
{
expect
(
project
.
errors
.
messages
[
:new_namespace
][
0
]).
to
eq
'Please select a n
ew namespace for your project.
'
}
end
context
'disallow transfering of project with tags'
do
...
...
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