Skip to content

Commit

Permalink
Use shared form partial for admin/rules views (#30067)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Apr 29, 2024
1 parent a9816f0 commit e336466
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 7 additions & 0 deletions app/views/admin/rules/_form.html.haml
@@ -0,0 +1,7 @@
.fields-group
= form.input :text,
wrapper: :with_block_label

.fields-group
= form.input :hint,
wrapper: :with_block_label
10 changes: 3 additions & 7 deletions app/views/admin/rules/edit.html.haml
@@ -1,14 +1,10 @@
- content_for :page_title do
= t('admin.rules.edit')

= simple_form_for @rule, url: admin_rule_path(@rule) do |f|
= simple_form_for @rule, url: admin_rule_path(@rule) do |form|
= render 'shared/error_messages', object: @rule

.fields-group
= f.input :text, wrapper: :with_block_label

.fields-group
= f.input :hint, 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
10 changes: 3 additions & 7 deletions app/views/admin/rules/index.html.haml
Expand Up @@ -6,17 +6,13 @@
%hr.spacer/

- if can? :create, :rule
= simple_form_for @rule, url: admin_rules_path do |f|
= simple_form_for @rule, url: admin_rules_path do |form|
= render 'shared/error_messages', object: @rule

.fields-group
= f.input :text, wrapper: :with_block_label

.fields-group
= f.input :hint, wrapper: :with_block_label
= render form

.actions
= f.button :button, t('admin.rules.add_new'), type: :submit
= form.button :button, t('admin.rules.add_new'), type: :submit

%hr.spacer/

Expand Down

0 comments on commit e336466

Please sign in to comment.