From 41e21b484b9960c0e734a3f0c4c525cff5893e89 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Thu, 22 Dec 2022 09:25:35 -0600 Subject: [PATCH 1/2] Disable automatically generating hints, placeholders and labels for simple_form changelog: Internal, Forms, Disable automatically generating hints and placeholders and labels for simple_form --- config/initializers/simple_form.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 2ee030df322..80ed9f1772f 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -14,6 +14,9 @@ } config.wrappers :base do |b| + b.optional :hint + b.optional :label + b.optional :placeholder b.use :html5 b.use :input, class: 'field' end @@ -22,13 +25,13 @@ tag: 'div', class: 'margin-bottom-4' do |b| b.use :html5 - b.use :placeholder + b.optional :placeholder b.optional :maxlength b.optional :pattern b.optional :min_max b.optional :readonly - b.use :label, class: 'usa-label' - b.use :hint, wrap_with: { tag: 'div', class: 'usa-hint' } + b.optional :label, class: 'usa-label' + b.optional :hint, wrap_with: { tag: 'div', class: 'usa-hint' } b.use :input, class: 'display-block width-full field', error_class: 'usa-input--error' b.use :error, wrap_with: { tag: 'div', class: 'usa-error-message' } end @@ -39,9 +42,9 @@ config.wrappers :uswds_checkbox do |b| b.use :html5 - b.use :hint, wrap_with: { tag: 'div', class: 'usa-hint' } + b.optional :hint, wrap_with: { tag: 'div', class: 'usa-hint' } b.use :input, class: 'usa-checkbox__input', error_class: 'usa-input--error' - b.use :label, class: 'usa-checkbox__label' + b.optional :label, class: 'usa-checkbox__label' b.use :error, wrap_with: { tag: 'div', class: 'usa-error-message' } end @@ -61,7 +64,7 @@ b.wrapper :legend, tag: 'legend', class: legend_class do |ba| ba.use :label_text end - b.use :hint, wrap_with: { tag: 'div', class: 'usa-hint margin-bottom-05' } + b.optional :hint, wrap_with: { tag: 'div', class: 'usa-hint margin-bottom-05' } b.wrapper :grid_row, tag: :div, class: 'grid-row margin-bottom-neg-1' do |gr| gr.wrapper :grid_column_radios, tag: :div, class: 'grid-col-fill' do |gc| gc.wrapper :column_wrapper, tag: :div, class: 'display-inline-block minw-full' do |cr| From ea28cb0dbaff6da42f40a42ac50f801247b11555 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Wed, 4 Jan 2023 14:36:55 -0600 Subject: [PATCH 2/2] additional optional label configuration --- config/initializers/simple_form.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 80ed9f1772f..7649f642f9e 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -62,7 +62,7 @@ item_label_class: item_label_class do |b| b.use :html5 b.wrapper :legend, tag: 'legend', class: legend_class do |ba| - ba.use :label_text + ba.optional :label_text end b.optional :hint, wrap_with: { tag: 'div', class: 'usa-hint margin-bottom-05' } b.wrapper :grid_row, tag: :div, class: 'grid-row margin-bottom-neg-1' do |gr|