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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d60cc09b
Commit
d60cc09b
authored
Sep 11, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
67d1be5c
43a40ac9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
7 deletions
+68
-7
app/assets/javascripts/groups/transfer_dropdown.js
app/assets/javascripts/groups/transfer_dropdown.js
+2
-1
app/assets/javascripts/pages/groups/edit/index.js
app/assets/javascripts/pages/groups/edit/index.js
+2
-0
app/assets/javascripts/pages/projects/edit/index.js
app/assets/javascripts/pages/projects/edit/index.js
+2
-2
app/assets/javascripts/transfer_edit.js
app/assets/javascripts/transfer_edit.js
+3
-3
app/views/groups/settings/_advanced.html.haml
app/views/groups/settings/_advanced.html.haml
+1
-1
changelogs/unreleased/64799-disable-transfer-group.yml
changelogs/unreleased/64799-disable-transfer-group.yml
+5
-0
spec/frontend/transfer_edit_spec.js
spec/frontend/transfer_edit_spec.js
+53
-0
No files found.
app/assets/javascripts/groups/transfer_dropdown.js
View file @
d60cc09b
...
@@ -14,7 +14,7 @@ export default class TransferDropdown {
...
@@ -14,7 +14,7 @@ export default class TransferDropdown {
}
}
buildDropdown
()
{
buildDropdown
()
{
const
extraOptions
=
[{
id
:
''
,
text
:
__
(
'
No parent group
'
)
},
'
divider
'
];
const
extraOptions
=
[{
id
:
'
-1
'
,
text
:
__
(
'
No parent group
'
)
},
'
divider
'
];
this
.
groupDropdown
.
glDropdown
({
this
.
groupDropdown
.
glDropdown
({
selectable
:
true
,
selectable
:
true
,
...
@@ -33,5 +33,6 @@ export default class TransferDropdown {
...
@@ -33,5 +33,6 @@ export default class TransferDropdown {
assignSelected
(
selected
)
{
assignSelected
(
selected
)
{
this
.
parentInput
.
val
(
selected
.
id
);
this
.
parentInput
.
val
(
selected
.
id
);
this
.
parentInput
.
change
();
}
}
}
}
app/assets/javascripts/pages/groups/edit/index.js
View file @
d60cc09b
...
@@ -2,6 +2,7 @@ import initAvatarPicker from '~/avatar_picker';
...
@@ -2,6 +2,7 @@ import initAvatarPicker from '~/avatar_picker';
import
TransferDropdown
from
'
~/groups/transfer_dropdown
'
;
import
TransferDropdown
from
'
~/groups/transfer_dropdown
'
;
import
initConfirmDangerModal
from
'
~/confirm_danger_modal
'
;
import
initConfirmDangerModal
from
'
~/confirm_danger_modal
'
;
import
initSettingsPanels
from
'
~/settings_panels
'
;
import
initSettingsPanels
from
'
~/settings_panels
'
;
import
setupTransferEdit
from
'
~/transfer_edit
'
;
import
dirtySubmitFactory
from
'
~/dirty_submit/dirty_submit_factory
'
;
import
dirtySubmitFactory
from
'
~/dirty_submit/dirty_submit_factory
'
;
import
mountBadgeSettings
from
'
~/pages/shared/mount_badge_settings
'
;
import
mountBadgeSettings
from
'
~/pages/shared/mount_badge_settings
'
;
import
{
GROUP_BADGE
}
from
'
~/badges/constants
'
;
import
{
GROUP_BADGE
}
from
'
~/badges/constants
'
;
...
@@ -17,6 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -17,6 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
document
.
querySelectorAll
(
'
.js-general-settings-form, .js-general-permissions-form
'
),
document
.
querySelectorAll
(
'
.js-general-settings-form, .js-general-permissions-form
'
),
);
);
mountBadgeSettings
(
GROUP_BADGE
);
mountBadgeSettings
(
GROUP_BADGE
);
setupTransferEdit
(
'
.js-group-transfer-form
'
,
'
#new_parent_group_id
'
);
// Initialize Subgroups selector
// Initialize Subgroups selector
groupsSelect
();
groupsSelect
();
...
...
app/assets/javascripts/pages/projects/edit/index.js
View file @
d60cc09b
import
{
PROJECT_BADGE
}
from
'
~/badges/constants
'
;
import
{
PROJECT_BADGE
}
from
'
~/badges/constants
'
;
import
initSettingsPanels
from
'
~/settings_panels
'
;
import
initSettingsPanels
from
'
~/settings_panels
'
;
import
setup
ProjectEdit
from
'
~/project
_edit
'
;
import
setup
TransferEdit
from
'
~/transfer
_edit
'
;
import
initConfirmDangerModal
from
'
~/confirm_danger_modal
'
;
import
initConfirmDangerModal
from
'
~/confirm_danger_modal
'
;
import
mountBadgeSettings
from
'
~/pages/shared/mount_badge_settings
'
;
import
mountBadgeSettings
from
'
~/pages/shared/mount_badge_settings
'
;
import
dirtySubmitFactory
from
'
~/dirty_submit/dirty_submit_factory
'
;
import
dirtySubmitFactory
from
'
~/dirty_submit/dirty_submit_factory
'
;
...
@@ -16,7 +16,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -16,7 +16,7 @@ document.addEventListener('DOMContentLoaded', () => {
initProjectLoadingSpinner
();
initProjectLoadingSpinner
();
initProjectPermissionsSettings
();
initProjectPermissionsSettings
();
setup
ProjectEdit
(
);
setup
TransferEdit
(
'
.js-project-transfer-form
'
,
'
select.select2
'
);
dirtySubmitFactory
(
dirtySubmitFactory
(
document
.
querySelectorAll
(
document
.
querySelectorAll
(
...
...
app/assets/javascripts/
project
_edit.js
→
app/assets/javascripts/
transfer
_edit.js
View file @
d60cc09b
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
export
default
function
setup
ProjectEdit
(
)
{
export
default
function
setup
TransferEdit
(
formSelector
,
targetSelector
)
{
const
$transferForm
=
$
(
'
.js-project-transfer-form
'
);
const
$transferForm
=
$
(
formSelector
);
const
$selectNamespace
=
$transferForm
.
find
(
'
select.select2
'
);
const
$selectNamespace
=
$transferForm
.
find
(
targetSelector
);
$selectNamespace
.
on
(
'
change
'
,
()
=>
{
$selectNamespace
.
on
(
'
change
'
,
()
=>
{
$transferForm
.
find
(
'
:submit
'
).
prop
(
'
disabled
'
,
!
$selectNamespace
.
val
());
$transferForm
.
find
(
'
:submit
'
).
prop
(
'
disabled
'
,
!
$selectNamespace
.
val
());
...
...
app/views/groups/settings/_advanced.html.haml
View file @
d60cc09b
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
.sub-section
.sub-section
%h4
.warning-title
Transfer group
%h4
.warning-title
Transfer group
=
form_for
@group
,
url:
transfer_group_path
(
@group
),
method: :put
do
|
f
|
=
form_for
@group
,
url:
transfer_group_path
(
@group
),
method: :put
,
html:
{
class:
'js-group-transfer-form'
}
do
|
f
|
.form-group
.form-group
=
dropdown_tag
(
'Select parent group'
,
options:
{
toggle_class:
'js-groups-dropdown'
,
title:
'Parent Group'
,
filter:
true
,
dropdown_class:
'dropdown-open-top dropdown-group-transfer'
,
placeholder:
'Search groups'
,
data:
{
data:
parent_group_options
(
@group
)
}
})
=
dropdown_tag
(
'Select parent group'
,
options:
{
toggle_class:
'js-groups-dropdown'
,
title:
'Parent Group'
,
filter:
true
,
dropdown_class:
'dropdown-open-top dropdown-group-transfer'
,
placeholder:
'Search groups'
,
data:
{
data:
parent_group_options
(
@group
)
}
})
=
hidden_field_tag
'new_parent_group_id'
=
hidden_field_tag
'new_parent_group_id'
...
...
changelogs/unreleased/64799-disable-transfer-group.yml
0 → 100644
View file @
d60cc09b
---
title
:
Disable "Transfer group" button when no group is selected
merge_request
:
31387
author
:
Jan Beckmann
type
:
fixed
spec/frontend/transfer_edit_spec.js
0 → 100644
View file @
d60cc09b
import
$
from
'
jquery
'
;
import
setupTransferEdit
from
'
~/transfer_edit
'
;
import
{
loadHTMLFixture
}
from
'
helpers/fixtures
'
;
describe
(
'
setupTransferEdit
'
,
()
=>
{
const
formSelector
=
'
.js-project-transfer-form
'
;
const
targetSelector
=
'
select.select2
'
;
beforeEach
(()
=>
{
loadHTMLFixture
(
'
projects/edit.html
'
);
setupTransferEdit
(
formSelector
,
targetSelector
);
});
it
(
'
disables submit button on load
'
,
()
=>
{
expect
(
$
(
formSelector
)
.
find
(
'
:submit
'
)
.
prop
(
'
disabled
'
),
).
toBe
(
true
);
});
it
(
'
enables submit button when selection changes to non-empty value
'
,
()
=>
{
const
nonEmptyValue
=
$
(
formSelector
)
.
find
(
targetSelector
)
.
find
(
'
option
'
)
.
not
(
'
:empty
'
)
.
val
();
$
(
formSelector
)
.
find
(
targetSelector
)
.
val
(
nonEmptyValue
)
.
trigger
(
'
change
'
);
expect
(
$
(
formSelector
)
.
find
(
'
:submit
'
)
.
prop
(
'
disabled
'
),
).
toBeFalsy
();
});
it
(
'
disables submit button when selection changes to empty value
'
,
()
=>
{
$
(
formSelector
)
.
find
(
targetSelector
)
.
val
(
''
)
.
trigger
(
'
change
'
);
expect
(
$
(
formSelector
)
.
find
(
'
:submit
'
)
.
prop
(
'
disabled
'
),
).
toBe
(
true
);
});
});
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