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
197a5df4
Commit
197a5df4
authored
Jul 05, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow admin to disable all restricted visibility levels
parent
81dba76b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
5 deletions
+26
-5
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+2
-0
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+4
-4
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+3
-1
changelogs/unreleased/32408-enable-disable-all-restricted-visibility-levels.yml
...32408-enable-disable-all-restricted-visibility-levels.yml
+4
-0
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+13
-0
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
197a5df4
...
...
@@ -71,6 +71,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params
[
:application_setting
][
:disabled_oauth_sign_in_sources
]
=
AuthHelper
.
button_based_providers
.
map
(
&
:to_s
)
-
Array
(
enabled_oauth_sign_in_sources
)
params
[
:application_setting
][
:restricted_visibility_levels
]
&
.
delete
(
""
)
params
.
delete
(
:domain_blacklist_raw
)
if
params
[
:domain_blacklist_file
]
params
.
require
(
:application_setting
).
permit
(
...
...
app/helpers/application_settings_helper.rb
View file @
197a5df4
...
...
@@ -34,17 +34,17 @@ module ApplicationSettingsHelper
# Return a group of checkboxes that use Bootstrap's button plugin for a
# toggle button effect.
def
restricted_level_checkboxes
(
help_block_id
)
def
restricted_level_checkboxes
(
help_block_id
,
checkbox_name
)
Gitlab
::
VisibilityLevel
.
options
.
map
do
|
name
,
level
|
checked
=
restricted_visibility_levels
(
true
).
include?
(
level
)
css_class
=
checked
?
'active'
:
''
checkbox_name
=
"application_setting[restricted_visibility_levels][]
"
tag_name
=
"application_setting_visibility_level_
#{
level
}
"
label_tag
(
name
,
class:
css_class
)
do
label_tag
(
tag_
name
,
class:
css_class
)
do
check_box_tag
(
checkbox_name
,
level
,
checked
,
autocomplete:
'off'
,
'aria-describedby'
=>
help_block_id
,
id:
name
)
+
visibility_level_icon
(
level
)
+
name
id:
tag_
name
)
+
visibility_level_icon
(
level
)
+
name
end
end
end
...
...
app/views/admin/application_settings/_form.html.haml
View file @
197a5df4
...
...
@@ -22,7 +22,9 @@
.form-group
=
f
.
label
:restricted_visibility_levels
,
class:
'control-label col-sm-2'
.col-sm-10
-
restricted_level_checkboxes
(
'restricted-visibility-help'
).
each
do
|
level
|
-
checkbox_name
=
'application_setting[restricted_visibility_levels][]'
=
hidden_field_tag
(
checkbox_name
)
-
restricted_level_checkboxes
(
'restricted-visibility-help'
,
checkbox_name
).
each
do
|
level
|
.checkbox
=
level
%span
.help-block
#restricted-visibility-help
...
...
changelogs/unreleased/32408-enable-disable-all-restricted-visibility-levels.yml
0 → 100644
View file @
197a5df4
---
title
:
Allow admins to disable all restricted visibility levels
merge_request
:
12649
author
:
spec/features/admin/admin_settings_spec.rb
View file @
197a5df4
...
...
@@ -16,6 +16,19 @@ feature 'Admin updates settings', feature: true do
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
scenario
'Uncheck all restricted visibility levels'
do
find
(
'#application_setting_visibility_level_0'
).
set
(
false
)
find
(
'#application_setting_visibility_level_10'
).
set
(
false
)
find
(
'#application_setting_visibility_level_20'
).
set
(
false
)
click_button
'Save'
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
find
(
'#application_setting_visibility_level_0'
)).
not_to
be_checked
expect
(
find
(
'#application_setting_visibility_level_10'
)).
not_to
be_checked
expect
(
find
(
'#application_setting_visibility_level_20'
)).
not_to
be_checked
end
scenario
'Change application settings'
do
uncheck
'Gravatar enabled'
fill_in
'Home page URL'
,
with:
'https://about.gitlab.com/'
...
...
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