diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/views/shared/namespaces | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/views/shared/namespaces')
6 files changed, 44 insertions, 25 deletions
diff --git a/app/views/shared/namespaces/cascading_settings/_enforcement_checkbox.html.haml b/app/views/shared/namespaces/cascading_settings/_enforcement_checkbox.html.haml index 1e9aa4ec5ff..ab4d8816ec9 100644 --- a/app/views/shared/namespaces/cascading_settings/_enforcement_checkbox.html.haml +++ b/app/views/shared/namespaces/cascading_settings/_enforcement_checkbox.html.haml @@ -1,14 +1,17 @@ - attribute = local_assigns.fetch(:attribute, nil) -- group = local_assigns.fetch(:group, nil) - form = local_assigns.fetch(:form, nil) +- setting_locked = local_assigns.fetch(:setting_locked, false) +- help_text = local_assigns.fetch(:help_text, s_('CascadingSettings|Subgroups cannot change this setting.')) - return unless attribute && group && form && cascading_namespace_settings_enabled? -- return if group.namespace_settings.public_send("#{attribute}_locked?") +- return if setting_locked - lock_attribute = "lock_#{attribute}" .gl-form-checkbox.custom-control.custom-checkbox = form.check_box lock_attribute, checked: group.namespace_settings.public_send(lock_attribute), class: 'custom-control-input', data: { testid: 'enforce-for-all-subgroups-checkbox' } = form.label lock_attribute, class: 'custom-control-label' do - %span= s_('CascadingSettings|Enforce for all subgroups') - %p.help-text= s_('CascadingSettings|Subgroups cannot change this setting.') + %span + = yield.presence || s_('CascadingSettings|Enforce for all subgroups') + %p.help-text + = help_text diff --git a/app/views/shared/namespaces/cascading_settings/_lock_icon.html.haml b/app/views/shared/namespaces/cascading_settings/_lock_icon.html.haml new file mode 100644 index 00000000000..4e3b6b2afc4 --- /dev/null +++ b/app/views/shared/namespaces/cascading_settings/_lock_icon.html.haml @@ -0,0 +1,4 @@ +%button.position-absolute.gl-top-3.gl-right-0.gl-translate-y-n50.gl-cursor-default.btn.btn-default.btn-sm.gl-button.btn-default-tertiary.js-cascading-settings-lock-popover-target{ class: 'gl-p-1! gl-text-gray-600! gl-bg-transparent!', + type: 'button', + data: cascading_namespace_settings_popover_data(attribute, group, settings_path_helper) } + = sprite_icon('lock', size: 16) diff --git a/app/views/shared/namespaces/cascading_settings/_setting_label.html.haml b/app/views/shared/namespaces/cascading_settings/_setting_label.html.haml deleted file mode 100644 index 6596ce2bc73..00000000000 --- a/app/views/shared/namespaces/cascading_settings/_setting_label.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -- attribute = local_assigns.fetch(:attribute, nil) -- group = local_assigns.fetch(:group, nil) -- form = local_assigns.fetch(:form, nil) -- settings_path_helper = local_assigns.fetch(:settings_path_helper, nil) -- help_text = local_assigns.fetch(:help_text, nil) - -- return unless attribute && group && form && settings_path_helper - -- setting_locked = group.namespace_settings.public_send("#{attribute}_locked?") - -= form.label attribute, class: 'custom-control-label', aria: { disabled: setting_locked } do - %span.position-relative.gl-pr-6.gl-display-inline-flex - = yield - - if setting_locked - %button.position-absolute.gl-top-3.gl-right-0.gl-translate-y-n50.gl-cursor-default.btn.btn-default.btn-sm.gl-button.btn-default-tertiary.js-cascading-settings-lock-popover-target{ class: 'gl-p-1! gl-text-gray-600! gl-bg-transparent!', - type: 'button', - data: cascading_namespace_settings_popover_data(attribute, group, settings_path_helper) } - = sprite_icon('lock', size: 16) - - if help_text - %p.help-text - = help_text diff --git a/app/views/shared/namespaces/cascading_settings/_setting_label_checkbox.html.haml b/app/views/shared/namespaces/cascading_settings/_setting_label_checkbox.html.haml new file mode 100644 index 00000000000..d27b3641637 --- /dev/null +++ b/app/views/shared/namespaces/cascading_settings/_setting_label_checkbox.html.haml @@ -0,0 +1,16 @@ +- attribute = local_assigns.fetch(:attribute, nil) +- settings_path_helper = local_assigns.fetch(:settings_path_helper, nil) +- form = local_assigns.fetch(:form, nil) +- setting_locked = local_assigns.fetch(:setting_locked, false) +- help_text = local_assigns.fetch(:help_text, nil) + +- return unless attribute && form && settings_path_helper + += form.label attribute, class: 'custom-control-label', aria: { disabled: setting_locked } do + = render 'shared/namespaces/cascading_settings/setting_label_container' do + = yield + - if setting_locked + = render 'shared/namespaces/cascading_settings/lock_icon', local_assigns + - if help_text + %p.help-text + = help_text diff --git a/app/views/shared/namespaces/cascading_settings/_setting_label_container.html.haml b/app/views/shared/namespaces/cascading_settings/_setting_label_container.html.haml new file mode 100644 index 00000000000..7323295f1fe --- /dev/null +++ b/app/views/shared/namespaces/cascading_settings/_setting_label_container.html.haml @@ -0,0 +1,2 @@ +%span.position-relative.gl-pr-6.gl-display-inline-flex + = yield diff --git a/app/views/shared/namespaces/cascading_settings/_setting_label_fieldset.html.haml b/app/views/shared/namespaces/cascading_settings/_setting_label_fieldset.html.haml new file mode 100644 index 00000000000..4a2ec9f30fd --- /dev/null +++ b/app/views/shared/namespaces/cascading_settings/_setting_label_fieldset.html.haml @@ -0,0 +1,15 @@ +- attribute = local_assigns.fetch(:attribute, nil) +- settings_path_helper = local_assigns.fetch(:settings_path_helper, nil) +- setting_locked = local_assigns.fetch(:setting_locked, false) +- help_text = local_assigns.fetch(:help_text, nil) + +- return unless attribute && settings_path_helper + +%legend.h5.gl-border-none.gl-m-0 + = render 'shared/namespaces/cascading_settings/setting_label_container' do + = yield + - if setting_locked + = render 'shared/namespaces/cascading_settings/lock_icon', local_assigns +- if help_text + %p.gl-text-gray-500 + = help_text |