Commit 6bc89c0e authored by Sean McGivern's avatar Sean McGivern

Merge branch '47266-visiblity-import-sources-checkbox-styling' into 'master'

Resolve "Admin area > Import sources and restricted visibility level checkboxes styling"

Closes #47266

See merge request gitlab-org/gitlab-ce!19397
parents 0bd86052 ccc07601
...@@ -36,7 +36,7 @@ module ApplicationSettingsHelper ...@@ -36,7 +36,7 @@ module ApplicationSettingsHelper
# Return a group of checkboxes that use Bootstrap's button plugin for a # Return a group of checkboxes that use Bootstrap's button plugin for a
# toggle button effect. # toggle button effect.
def restricted_level_checkboxes(help_block_id, checkbox_name) def restricted_level_checkboxes(help_block_id, checkbox_name, options = {})
Gitlab::VisibilityLevel.values.map do |level| Gitlab::VisibilityLevel.values.map do |level|
checked = restricted_visibility_levels(true).include?(level) checked = restricted_visibility_levels(true).include?(level)
css_class = checked ? 'active' : '' css_class = checked ? 'active' : ''
...@@ -46,6 +46,7 @@ module ApplicationSettingsHelper ...@@ -46,6 +46,7 @@ module ApplicationSettingsHelper
check_box_tag(checkbox_name, level, checked, check_box_tag(checkbox_name, level, checked,
autocomplete: 'off', autocomplete: 'off',
'aria-describedby' => help_block_id, 'aria-describedby' => help_block_id,
'class' => options[:class],
id: tag_name) + visibility_level_icon(level) + visibility_level_label(level) id: tag_name) + visibility_level_icon(level) + visibility_level_label(level)
end end
end end
...@@ -53,7 +54,7 @@ module ApplicationSettingsHelper ...@@ -53,7 +54,7 @@ module ApplicationSettingsHelper
# Return a group of checkboxes that use Bootstrap's button plugin for a # Return a group of checkboxes that use Bootstrap's button plugin for a
# toggle button effect. # toggle button effect.
def import_sources_checkboxes(help_block_id) def import_sources_checkboxes(help_block_id, options = {})
Gitlab::ImportSources.options.map do |name, source| Gitlab::ImportSources.options.map do |name, source|
checked = Gitlab::CurrentSettings.import_sources.include?(source) checked = Gitlab::CurrentSettings.import_sources.include?(source)
css_class = checked ? 'active' : '' css_class = checked ? 'active' : ''
...@@ -63,6 +64,7 @@ module ApplicationSettingsHelper ...@@ -63,6 +64,7 @@ module ApplicationSettingsHelper
check_box_tag(checkbox_name, source, checked, check_box_tag(checkbox_name, source, checked,
autocomplete: 'off', autocomplete: 'off',
'aria-describedby' => help_block_id, 'aria-describedby' => help_block_id,
'class' => options[:class],
id: name.tr(' ', '_')) + name id: name.tr(' ', '_')) + name
end end
end end
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
.col-sm-10 .col-sm-10
- checkbox_name = 'application_setting[restricted_visibility_levels][]' - checkbox_name = 'application_setting[restricted_visibility_levels][]'
= hidden_field_tag(checkbox_name) = hidden_field_tag(checkbox_name)
- restricted_level_checkboxes('restricted-visibility-help', checkbox_name).each do |level| - restricted_level_checkboxes('restricted-visibility-help', checkbox_name, class: 'form-check-input').each do |level|
.form-check .form-check
= level = level
%span.form-text.text-muted#restricted-visibility-help %span.form-text.text-muted#restricted-visibility-help
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
= f.label :import_sources, class: 'col-form-label col-sm-2' = f.label :import_sources, class: 'col-form-label col-sm-2'
.col-sm-10 .col-sm-10
= hidden_field_tag 'application_setting[import_sources][]' = hidden_field_tag 'application_setting[import_sources][]'
- import_sources_checkboxes('import-sources-help').each do |source| - import_sources_checkboxes('import-sources-help', class: 'form-check-input').each do |source|
.form-check= source .form-check= source
%span.form-text.text-muted#import-sources-help %span.form-text.text-muted#import-sources-help
Enabled sources for code import during project creation. OmniAuth must be configured for GitHub Enabled sources for code import during project creation. OmniAuth must be configured for GitHub
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment