From 09d1197ee823cfa7d1425f6498ba0686dcbf8a12 Mon Sep 17 00:00:00 2001 From: Oleh Fedorenko Date: Mon, 4 Sep 2023 16:10:28 +0000 Subject: [PATCH] Fixes #36718 - Mark required fields for policy --- app/helpers/policies_helper.rb | 2 ++ .../policies/steps/_policy_attributes_form.html.erb | 2 +- app/views/policies/steps/_schedule_form.html.erb | 12 ++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/helpers/policies_helper.rb b/app/helpers/policies_helper.rb index 81db1114c..0a51cd81d 100644 --- a/app/helpers/policies_helper.rb +++ b/app/helpers/policies_helper.rb @@ -55,11 +55,13 @@ def scap_content_selector(form) select_f form, :scap_content_id, scap_contents, :id, :title, { :include_blank => _("Choose existing SCAP Content") }, { :label => _("SCAP Content"), + :required => true, :onchange => 'scap_content_selected(this);', :'data-url' => method_path('scap_content_selected') } else select_f form, :scap_content_id, scap_contents, :id, :title, { :label => _("SCAP Content"), + :required => true, :onchange => 'scap_content_selected(this);', :'data-url' => method_path('scap_content_selected') } end diff --git a/app/views/policies/steps/_policy_attributes_form.html.erb b/app/views/policies/steps/_policy_attributes_form.html.erb index 679145e23..803330582 100644 --- a/app/views/policies/steps/_policy_attributes_form.html.erb +++ b/app/views/policies/steps/_policy_attributes_form.html.erb @@ -1,5 +1,5 @@
<%= wizard_header @policy.step_index, *translate_steps(@policy) %> - <%= text_f(f, :name) %> + <%= text_f(f, :name, :required => true) %> <%= text_f(f, :description, :size => "col-md-8" ) %>
diff --git a/app/views/policies/steps/_schedule_form.html.erb b/app/views/policies/steps/_schedule_form.html.erb index 6a65708b4..fd2cc06c1 100644 --- a/app/views/policies/steps/_schedule_form.html.erb +++ b/app/views/policies/steps/_schedule_form.html.erb @@ -4,8 +4,12 @@ <%= wizard_header @policy.step_index, *@policy.steps %> <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s, { :include_blank => _('Choose period') }, - { :onchange => 'period_selected(this)' }) %> - <%= select_f(f, :weekday, days_of_week_hash, :first, :last, :include_blank => _('Choose weekday')) %> - <%= select_f(f, :day_of_month, (1..31).to_a, :to_i, :to_s, :help_inline => _('Number of a day in month, note that not all months have same count of days'), :include_blank => _('Choose day in month')) %> - <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %> + { :onchange => 'period_selected(this)', :required => true }) %> + <%= select_f(f, :weekday, days_of_week_hash, :first, :last, + { :include_blank => _('Choose weekday') }, + { :required => true }) %> + <%= select_f(f, :day_of_month, (1..31).to_a, :to_i, :to_s, + { :include_blank => _('Choose day in month') }, + { :help_inline => _('Number of a day in month, note that not all months have same count of days'), :required => true }) %> + <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space'), :required => true) %>