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
Léo-Paul Géneau
gitlab-ce
Commits
4da474ca
Commit
4da474ca
authored
Sep 02, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hides merge request section in edit project when disabled
parent
fd1741b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
15 deletions
+75
-15
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+4
-4
app/views/projects/_merge_request_settings.html.haml
app/views/projects/_merge_request_settings.html.haml
+14
-11
spec/features/projects/edit_spec.rb
spec/features/projects/edit_spec.rb
+57
-0
No files found.
app/assets/javascripts/project_new.js
View file @
4da474ca
...
...
@@ -15,18 +15,18 @@
}
ProjectNew
.
prototype
.
toggleSettings
=
function
()
{
this
.
_showOrHide
(
'
#project_
builds_enabled
'
,
'
.builds-feature
'
);
return
this
.
_showOrHide
(
'
#project_merge_requests_enabled
'
,
'
.merge-requests-feature
'
);
this
.
_showOrHide
(
'
#project_
project_feature_attributes_builds_access_level
'
,
'
.builds-feature
'
);
this
.
_showOrHide
(
'
#project_project_feature_attributes_merge_requests_access_level
'
,
'
.merge-requests-feature
'
);
};
ProjectNew
.
prototype
.
toggleSettingsOnclick
=
function
()
{
return
$
(
'
#project_builds_enabled, #project_merge_requests_enabled
'
).
on
(
'
click
'
,
this
.
toggleSettings
);
$
(
'
#project_project_feature_attributes_builds_access_level, #project_project_feature_attributes_merge_requests_access_level
'
).
on
(
'
change
'
,
this
.
toggleSettings
);
};
ProjectNew
.
prototype
.
_showOrHide
=
function
(
checkElement
,
container
)
{
var
$container
;
$container
=
$
(
container
);
if
(
$
(
checkElement
).
prop
(
'
checked
'
)
)
{
if
(
$
(
checkElement
).
val
()
!==
'
0
'
)
{
return
$container
.
show
();
}
else
{
return
$container
.
hide
();
...
...
app/views/projects/_merge_request_settings.html.haml
View file @
4da474ca
%fieldset
.builds-feature
%h5
.prepend-top-0
Merge Requests
.form-group
.checkbox
=
f
.
label
:only_allow_merge_if_build_succeeds
do
=
f
.
check_box
:only_allow_merge_if_build_succeeds
%strong
Only allow merge requests to be merged if the build succeeds
.help-block
Builds need to be configured to enable this feature.
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/merge_requests'
,
anchor:
'only-allow-merge-requests-to-be-merged-if-the-build-succeeds'
)
.merge-requests-feature
%fieldset
.builds-feature
%hr
%h5
.prepend-top-0
Merge Requests
.form-group
.checkbox
=
f
.
label
:only_allow_merge_if_build_succeeds
do
=
f
.
check_box
:only_allow_merge_if_build_succeeds
%strong
Only allow merge requests to be merged if the build succeeds
%br
%span
.descr
Builds need to be configured to enable this feature.
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/merge_requests'
,
anchor:
'only-allow-merge-requests-to-be-merged-if-the-build-succeeds'
)
spec/features/projects/edit_spec.rb
0 → 100644
View file @
4da474ca
require
'rails_helper'
feature
'Project edit'
,
feature:
true
,
js:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
visit
edit_namespace_project_path
(
project
.
namespace
,
project
)
end
context
'feature visibility'
do
context
'merge requests select'
do
it
'hides merge requests section'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_merge_requests_access_level'
)
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
end
it
'hides merge requests section after save'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_merge_requests_access_level'
)
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
click_button
'Save changes'
wait_for_ajax
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
end
end
context
'builds select'
do
it
'hides merge requests section'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_builds_access_level'
)
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
end
it
'hides merge requests section after save'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_builds_access_level'
)
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
click_button
'Save changes'
wait_for_ajax
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
end
end
end
end
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