From a9816f051d3a83763b5a07423da2684fa2d05ca9 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 29 Apr 2024 05:33:06 -0400 Subject: [PATCH] Use shared form partial for `admin/warning_presets` views (#30069) --- app/views/admin/warning_presets/_form.html.haml | 7 +++++++ app/views/admin/warning_presets/edit.html.haml | 10 +++------- app/views/admin/warning_presets/index.html.haml | 10 +++------- 3 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 app/views/admin/warning_presets/_form.html.haml diff --git a/app/views/admin/warning_presets/_form.html.haml b/app/views/admin/warning_presets/_form.html.haml new file mode 100644 index 000000000..cba74163c --- /dev/null +++ b/app/views/admin/warning_presets/_form.html.haml @@ -0,0 +1,7 @@ +.fields-group + = form.input :title, + wrapper: :with_block_label + +.fields-group + = form.input :text, + wrapper: :with_block_label diff --git a/app/views/admin/warning_presets/edit.html.haml b/app/views/admin/warning_presets/edit.html.haml index b5c5107ef..f0bd9c12e 100644 --- a/app/views/admin/warning_presets/edit.html.haml +++ b/app/views/admin/warning_presets/edit.html.haml @@ -1,14 +1,10 @@ - content_for :page_title do = t('admin.warning_presets.edit_preset') -= simple_form_for @warning_preset, url: admin_warning_preset_path(@warning_preset) do |f| += simple_form_for @warning_preset, url: admin_warning_preset_path(@warning_preset) do |form| = render 'shared/error_messages', object: @warning_preset - .fields-group - = f.input :title, wrapper: :with_block_label - - .fields-group - = f.input :text, wrapper: :with_block_label + = render form .actions - = f.button :button, t('generic.save_changes'), type: :submit + = form.button :button, t('generic.save_changes'), type: :submit diff --git a/app/views/admin/warning_presets/index.html.haml b/app/views/admin/warning_presets/index.html.haml index b26a13d96..22fee2105 100644 --- a/app/views/admin/warning_presets/index.html.haml +++ b/app/views/admin/warning_presets/index.html.haml @@ -2,17 +2,13 @@ = t('admin.warning_presets.title') - if can? :create, :account_warning_preset - = simple_form_for @warning_preset, url: admin_warning_presets_path do |f| + = simple_form_for @warning_preset, url: admin_warning_presets_path do |form| = render 'shared/error_messages', object: @warning_preset - .fields-group - = f.input :title, wrapper: :with_block_label - - .fields-group - = f.input :text, wrapper: :with_block_label + = render form .actions - = f.button :button, t('admin.warning_presets.add_new'), type: :submit + = form.button :button, t('admin.warning_presets.add_new'), type: :submit %hr.spacer/