Skip to content
Snippets Groups Projects

Use field level validation errors

All threads resolved!
2 files
+ 17
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -7,18 +7,23 @@
@@ -7,18 +7,23 @@
%p
%p
= s_('GroupSettings|Automatically ban users who download more than the specified number of projects within the specified interval.')
= s_('GroupSettings|Automatically ban users who download more than the specified number of projects within the specified interval.')
= form_errors(@group.namespace_settings)
- amount_errors = @group.namespace_settings.errors.full_messages_for(:unique_project_download_limit)
 
- interval_errors = @group.namespace_settings.errors.full_messages_for(:unique_project_download_limit_interval_in_seconds)
= gitlab_ui_form_for @group, url: group_settings_reporting_path(@group) do |f|
= gitlab_ui_form_for @group, url: group_settings_reporting_path(@group) do |f|
.form-group
.form-group{ data: { testid: 'unique_project_download_limit' } }
= f.label :unique_project_download_limit, s_('GroupSettings|Number of projects'), class: 'label-bold'
= f.label :unique_project_download_limit, s_('GroupSettings|Number of projects'), class: 'label-bold'
= f.number_field :unique_project_download_limit, value: @group.namespace_settings&.unique_project_download_limit, class: 'form-control gl-form-input'
= f.number_field :unique_project_download_limit, value: @group.namespace_settings&.unique_project_download_limit, class: ['form-control', 'gl-form-input', amount_errors.present? && 'is-invalid']
 
- amount_errors.each do |error|
 
.invalid-feedback= error
.form-text.text-muted
.form-text.text-muted
= s_("GroupSettings|The maximum number of unique projects a user can download within the specified interval before they're banned. Set to 0 to disable limiting.")
= s_("GroupSettings|The maximum number of unique projects a user can download within the specified interval before they're banned. Set to 0 to disable limiting.")
.form-group
.form-group{ data: { testid: 'unique_project_download_limit_interval_in_seconds' } }
= f.label :unique_project_download_limit_interval_in_seconds, s_('GroupSettings|Interval (seconds)'), class: 'label-bold'
= f.label :unique_project_download_limit_interval_in_seconds, s_('GroupSettings|Interval (seconds)'), class: 'label-bold'
= f.number_field :unique_project_download_limit_interval_in_seconds, value: @group.namespace_settings&.unique_project_download_limit_interval_in_seconds, class: 'form-control gl-form-input'
= f.number_field :unique_project_download_limit_interval_in_seconds, value: @group.namespace_settings&.unique_project_download_limit_interval_in_seconds, class: ['form-control', 'gl-form-input', interval_errors.present? && 'is-invalid']
 
- interval_errors.each do |error|
 
.invalid-feedback= error
.form-text.text-muted
.form-text.text-muted
= s_('GroupSettings|Set to 0 to disable limiting.')
= s_('GroupSettings|Set to 0 to disable limiting.')
Loading