From 71607f694c2c97868d08a0de3dfc34d695b05cfb Mon Sep 17 00:00:00 2001 From: Noah Heck Date: Wed, 3 Mar 2021 16:15:27 -0700 Subject: [PATCH] Ensure proper rendering of form fields Make sure details/description attributes have new lines rendered Output the description value for Name/Address combination fields --- resources/views/_form/checkbox.blade.php | 2 +- .../views/_form/checkboxSwitch.blade.php | 2 +- resources/views/_form/date.blade.php | 2 +- resources/views/_form/decimal.blade.php | 2 +- resources/views/_form/email.blade.php | 2 +- resources/views/_form/file-search.blade.php | 2 +- .../views/_form/file-type-select.blade.php | 2 +- resources/views/_form/file-upload.blade.php | 2 +- resources/views/_form/integer.blade.php | 2 +- resources/views/_form/money.blade.php | 2 +- resources/views/_form/multi-select.blade.php | 2 +- resources/views/_form/password.blade.php | 2 +- resources/views/_form/phone.blade.php | 2 +- resources/views/_form/radioGroup.blade.php | 2 +- resources/views/_form/select.blade.php | 2 +- .../views/_form/team-multi-select.blade.php | 2 +- resources/views/_form/team-select.blade.php | 2 +- resources/views/_form/text-editor.blade.php | 2 +- resources/views/_form/text.blade.php | 2 +- resources/views/_form/textarea.blade.php | 2 +- resources/views/_form/time.blade.php | 2 +- .../views/_form/user-multi-select.blade.php | 2 +- resources/views/_form/user-select.blade.php | 2 +- resources/views/_form_field/address.blade.php | 3 ++ resources/views/_form_field/name.blade.php | 3 ++ .../views/manual/en/form-fields.md.blade.php | 34 +++++++++++-------- 26 files changed, 48 insertions(+), 38 deletions(-) diff --git a/resources/views/_form/checkbox.blade.php b/resources/views/_form/checkbox.blade.php index 0b12e996..6e6bb280 100644 --- a/resources/views/_form/checkbox.blade.php +++ b/resources/views/_form/checkbox.blade.php @@ -18,7 +18,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif
diff --git a/resources/views/_form/checkboxSwitch.blade.php b/resources/views/_form/checkboxSwitch.blade.php index f9934c8b..7c29087e 100644 --- a/resources/views/_form/checkboxSwitch.blade.php +++ b/resources/views/_form/checkboxSwitch.blade.php @@ -14,6 +14,6 @@ @if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif diff --git a/resources/views/_form/date.blade.php b/resources/views/_form/date.blade.php index 1b10d98f..55a3c409 100644 --- a/resources/views/_form/date.blade.php +++ b/resources/views/_form/date.blade.php @@ -16,7 +16,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif @endunless
diff --git a/resources/views/_form/decimal.blade.php b/resources/views/_form/decimal.blade.php index 5832d7e3..bd1c180c 100644 --- a/resources/views/_form/decimal.blade.php +++ b/resources/views/_form/decimal.blade.php @@ -17,7 +17,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif @endunless diff --git a/resources/views/_form/email.blade.php b/resources/views/_form/email.blade.php index 0ffbe2a5..357a87da 100644 --- a/resources/views/_form/email.blade.php +++ b/resources/views/_form/email.blade.php @@ -16,7 +16,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif @endunless
diff --git a/resources/views/_form/file-search.blade.php b/resources/views/_form/file-search.blade.php index daf2fb2d..721c4422 100644 --- a/resources/views/_form/file-search.blade.php +++ b/resources/views/_form/file-search.blade.php @@ -17,7 +17,7 @@
@if ($description ?? false) -

{{ $description }}

+

{!! nl2br(e($description)) !!}

@endif @endunless
diff --git a/resources/views/_form/file-type-select.blade.php b/resources/views/_form/file-type-select.blade.php index 2413e019..90e79343 100644 --- a/resources/views/_form/file-type-select.blade.php +++ b/resources/views/_form/file-type-select.blade.php @@ -16,7 +16,7 @@
@if ($description ?? false) -

{{ $description }}

+

{!! nl2br(e($description)) !!}

@endif @endunless diff --git a/resources/views/_form/money.blade.php b/resources/views/_form/money.blade.php index 1afc348e..cb12b6eb 100644 --- a/resources/views/_form/money.blade.php +++ b/resources/views/_form/money.blade.php @@ -15,7 +15,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif @endunless
diff --git a/resources/views/_form/multi-select.blade.php b/resources/views/_form/multi-select.blade.php index 318b42c9..b1e6eb20 100644 --- a/resources/views/_form/multi-select.blade.php +++ b/resources/views/_form/multi-select.blade.php @@ -20,7 +20,7 @@ @endif @if ($description ?? false) -

{{ $description }}

+

{!! nl2br(e($description)) !!}

@endif @endunless diff --git a/resources/views/_form/phone.blade.php b/resources/views/_form/phone.blade.php index 5203f192..ed610d11 100644 --- a/resources/views/_form/phone.blade.php +++ b/resources/views/_form/phone.blade.php @@ -15,7 +15,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@else (xxx) xxx-xxxx @endif diff --git a/resources/views/_form/radioGroup.blade.php b/resources/views/_form/radioGroup.blade.php index 2264fcc1..c4f0abb4 100644 --- a/resources/views/_form/radioGroup.blade.php +++ b/resources/views/_form/radioGroup.blade.php @@ -24,7 +24,7 @@

{{ $label }} @if ($description) -
{{ $description }} +
{!! nl2br(e($description)) !!} @endif

diff --git a/resources/views/_form/select.blade.php b/resources/views/_form/select.blade.php index a57396b7..e8dbff38 100644 --- a/resources/views/_form/select.blade.php +++ b/resources/views/_form/select.blade.php @@ -18,7 +18,7 @@
@if ($details ?? false) -

{{ $details }}

+

{!! nl2br(e($details)) !!}

@endif @endunless diff --git a/resources/views/_form/team-select.blade.php b/resources/views/_form/team-select.blade.php index 5fca96c3..343a52a7 100644 --- a/resources/views/_form/team-select.blade.php +++ b/resources/views/_form/team-select.blade.php @@ -16,7 +16,7 @@
@if ($description ?? false) -

{{ $description }}

+

{!! nl2br(e($description)) !!}

@endif @endunless diff --git a/resources/views/_form/time.blade.php b/resources/views/_form/time.blade.php index f511f1d6..f6a6cf66 100644 --- a/resources/views/_form/time.blade.php +++ b/resources/views/_form/time.blade.php @@ -16,7 +16,7 @@
@if ($details ?? false) - - {{ $details }} +

{!! nl2br(e($details)) !!}

@endif @endunless
diff --git a/resources/views/_form/user-multi-select.blade.php b/resources/views/_form/user-multi-select.blade.php index 0e4e0974..7c73425f 100644 --- a/resources/views/_form/user-multi-select.blade.php +++ b/resources/views/_form/user-multi-select.blade.php @@ -16,7 +16,7 @@
@if ($description ?? false) -

{{ $description }}

+

{!! nl2br(e($description)) !!}

@endif @endunless diff --git a/resources/views/_form_field/address.blade.php b/resources/views/_form_field/address.blade.php index c301abb1..4c7b43ee 100644 --- a/resources/views/_form_field/address.blade.php +++ b/resources/views/_form_field/address.blade.php @@ -2,6 +2,9 @@
+ @if($description = $field->description) +

{!! nl2br(e($description)) !!}

+ @endif
diff --git a/resources/views/_form_field/name.blade.php b/resources/views/_form_field/name.blade.php index bb7f7c13..9217b87a 100644 --- a/resources/views/_form_field/name.blade.php +++ b/resources/views/_form_field/name.blade.php @@ -2,6 +2,9 @@
+ @if($description = $field->description) +

{!! nl2br(e($description)) !!}

+ @endif
diff --git a/resources/views/manual/en/form-fields.md.blade.php b/resources/views/manual/en/form-fields.md.blade.php index f8f839d2..ff726a3c 100644 --- a/resources/views/manual/en/form-fields.md.blade.php +++ b/resources/views/manual/en/form-fields.md.blade.php @@ -85,7 +85,7 @@ @dateField([ 'name' => 'date', 'label' => 'Date', - 'details' => 'Use this field for date values; a calendar will appear to help make selecting the correct date easy!', + 'details' => 'Use this field for date values. A calendar will appear to help make selecting the correct date easy!', 'value' => '', 'placeholder' => '', 'required' => false, @@ -100,7 +100,7 @@ @phoneField([ 'name' => 'phone', 'label' => 'Phone Number', - 'details' => 'Use this field for phone numbers; the phone number will be formatted as the user enters it to help ensure accuracy!', + 'details' => 'Use this field for phone numbers. The phone number will be formatted as the user enters it to help ensure accuracy!', 'value' => '', 'required' => false, 'autofocus' => false, @@ -122,7 +122,7 @@ @integerField([ 'name' => 'integer', 'label' => 'Integer Field', - 'details' => 'Use this field for integer data points; many browsers will include a widget for these fields to help make selecting the appropriate value easier.', + 'details' => 'Use this field for integer data points. Many browsers will include a widget for these fields to help make selecting the appropriate value easier.', 'value' => '', 'placeholder' => '', 'required' => false, @@ -137,7 +137,7 @@ @decimalField([ 'name' => 'decimal', 'label' => 'Decimal Field', - 'details' => 'Used to gather numeric values with a decimal point; the number of decimal points the field will accept and validate is configurable (up to 4 decimal points). This field has a configured value of 2 decimal points.', + 'details' => 'Used to gather numeric values with a decimal point. The number of decimal points the field will accept and validate is configurable (up to 4 decimal points). This field has a configured value of 2 decimal points.', 'value' => '', 'decimalPlaces' => '2', 'placeholder' => '', @@ -197,7 +197,7 @@ 'name' => 'checkbox', 'id' => 'checkbox', 'label' => 'Checkbox Field', - 'details' => 'Checkbox fields are used to indicate a value as affirmative or negative. Use them to indicate state (e.g., Follow Up Required), or to indicate the presence or absence of a condition (e.g., Restricted Diet).', + 'details' => 'Checkbox fields are used to indicate a value as affirmative or negative. Use them to indicate state (e.g., Follow Up Required), or to indicate the presence/absence of a condition (e.g., Restricted Diet, Wears Glasses, or Requires Notification).', 'checked' => false, 'value' => '', 'required' => false, @@ -238,12 +238,14 @@
-**Name Field** - -The Name Field is used to collect a person's name, including First, Middle, and Last name, and a possible suffix. +@php + $nameField = new \App\FormDoc\Template\Field; + $nameField->label = 'Name Field'; + $nameField->description = "The Name Field is used to collect a person's name, including First, Middle, and Last name, and a possible suffix."; +@endphp @include('_form_field.name', [ - 'field' => new \App\FormDoc\Template\Field(), + 'field' => $nameField, 'value' => optional((object) []), 'readonly' => false, ]) @@ -252,12 +254,14 @@
-**Address Field** - -Use the Address Field to collect all of the details for a US address. +@php + $addressField = new \App\FormDoc\Template\Field; + $addressField->label = 'Address Field'; + $addressField->description = "Use the Address Field to collect all of the details for a US address."; +@endphp @include('_form_field.address', [ - 'field' => new \App\FormDoc\Template\Field(), + 'field' => $addressField, 'value' => optional((object) []), 'readonly' => false, ]) @@ -276,7 +280,7 @@ 'name' => 'user', 'label' => 'User Field', 'value' => '', - 'users' => \App\User::active()->get(), + 'users' => collect([Auth::user()]), 'placeholder' => 'Select a user', 'description' => "The User Field allows staff to select an Office Forge user for a field's value. The options that appear in the list can be filtered by Team to ensure only appropriate user's can be selected for an individual field.", 'required' => false, @@ -310,7 +314,7 @@ ### Additional Fields -
+
@include('_form_field.section-header', [ 'field' => (object) [