-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Form row component experiment #17921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
snipe
wants to merge
32
commits into
develop
Choose a base branch
from
form-row-component-experiment
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8ce3001
First stab
snipe 9023eda
Changed class
snipe 514711d
Label blade component
snipe 7c0c3b2
Use shorthand for errors
snipe e138c93
Added maxlength default for text
snipe 5c716c3
Updated notes maxlength
snipe 671e79f
Sorry, this shouldn’t have been in there :(
snipe a59914e
Added placeholder back in
snipe 253026d
Updated locations edit
snipe c4923fa
Updated address
snipe d2e3a13
Added ability to mark fields as disabled
snipe c3efdd0
Updated company
snipe 433a3e1
Fixed field type
snipe 2554b50
Updated suppliers
snipe 33e7425
Account for tooltips
snipe a3bad98
Added date and tooltip components
snipe b766f6e
Made edit screen narrower on wide screens
snipe 3863e82
Handle text and date fields on license edit
snipe 682c1a8
Make required false
snipe f8362f4
handled text fields in status labels
snipe 02a4268
Switched more fields to blade compaonents
snipe 1c09657
Handle checkboxes
snipe cde2297
More checkbox changes
snipe 150c205
Added checkboxes to status labels page
snipe 3b4c51b
Use slot instead of label
snipe f056147
Update resources/views/blade/input/text.blade.php
snipe 235dcbc
Updated more views
snipe 5782484
Update resources/views/blade/form-row.blade.php
snipe eea1922
Added checkbox and radios
snipe dc6ee34
Revert custom field name text box for now
snipe 08630d9
Remove radio buttons - they don’t work correctly yet
snipe 750c376
Set item to null so it doesn’t get merged automatically
snipe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- form-label blade component --> | ||
<label {{ $attributes->merge(['class' => 'control-label']) }}> | ||
{{ $slot }} | ||
</label> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<!-- form-row blade component --> | ||
@props([ | ||
'checkbox_value' => null, | ||
'disabled' => false, | ||
'div_style' => null, | ||
'error_offset_class' => 'col-md-7 col-md-offset-3', | ||
'errors', | ||
'help_text' => null, | ||
'info_tooltip_text' => null, | ||
'input_class' => null, | ||
'input_div_class' => 'col-md-8 col-sm-12', | ||
'input_group_addon' => null, | ||
'input_style' => null, | ||
'item' => null, | ||
'label' => null, | ||
'label_class' => 'col-md-3 col-sm-12 col-xs-12', | ||
'label_style' => null, | ||
'max' => null, | ||
'maxlength' => 191, | ||
'min' => null, | ||
'minlength' => null, | ||
'name' => null, | ||
'placeholder' => null, | ||
'step' => null, | ||
'type' => 'text', | ||
'value' => null, | ||
'value_text' => null, | ||
]) | ||
|
||
<div {{ $attributes->merge(['class' => 'form-group']) }}> | ||
|
||
@if (isset($label)) | ||
<x-form-label | ||
:for="$name" | ||
:style="$label_style ?? null" | ||
class="{{ $label_class }}" | ||
> | ||
{{ $label }} | ||
</x-form-label> | ||
@else | ||
@php | ||
$input_div_class = $input_div_class . ' ' . $error_offset_class; | ||
@endphp | ||
@endif | ||
|
||
|
||
<div {{ $attributes->merge(['class' => $input_div_class, 'style' => $div_style]) }}> | ||
|
||
@php | ||
$blade_type = in_array($type, ['text', 'email', 'url', 'tel', 'number', 'password']) ? 'text' : $type; | ||
@endphp | ||
|
||
<x-dynamic-component | ||
:$checkbox_value | ||
:$disabled | ||
:$input_group_addon | ||
:$input_style | ||
:$item | ||
:$max | ||
:$maxlength | ||
:$min | ||
:$minlength | ||
:$name | ||
:$placeholder | ||
:$step | ||
:$type | ||
:$value_text | ||
:aria-label="$name" | ||
:class="$input_class" | ||
:component="'input.'.$blade_type" | ||
:id="$name" | ||
:required="Helper::checkIfRequired($item, $name)" | ||
:value="old($name, $item->{$name})" | ||
/> | ||
</div> | ||
|
||
|
||
@if ($info_tooltip_text) | ||
<!-- Info Tooltip --> | ||
<div class="col-md-1 text-left" style="padding-left:0; margin-top: 5px;"> | ||
<x-input.info-tooltip> | ||
{{ $info_tooltip_text }} | ||
</x-input.info-tooltip> | ||
</div> | ||
@endif | ||
|
||
|
||
@error($name) | ||
<!-- Form Error --> | ||
<div {{ $attributes->merge(['class' => $error_offset_class]) }}> | ||
<span class="alert-msg" role="alert"> | ||
<i class="fas fa-times" aria-hidden="true"></i> | ||
{{ $message }} | ||
</span> | ||
</div> | ||
@enderror | ||
|
||
@if ($help_text) | ||
<!-- Help Text --> | ||
<div {{ $attributes->merge(['class' => $error_offset_class]) }}> | ||
<p class="help-block"> | ||
{!! $help_text !!} | ||
</p> | ||
</div> | ||
@endif | ||
|
||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@props([ | ||
'item' => null, | ||
'field_name' => null, | ||
'input_style' => null, | ||
'required' => false, | ||
'disabled' => false, | ||
'checkbox_value' => null, | ||
'name' => null, | ||
'label' => null, | ||
'value_text' => null, | ||
]) | ||
|
||
<label class="form-control{{ $disabled ? ' form-control--disabled' : '' }}"> | ||
<input type="checkbox" name="{{ $name }}" aria-label="{{ $name }}" value="{{ $checkbox_value }}" @checked(old($name, $item->$name)) {!! $disabled ? 'class="disabled" disabled' : '' !!}> | ||
{{ $value_text ?? $label }} | ||
</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@props([ | ||
'item' => null, | ||
'input_style' => null, | ||
'end_date' => null, | ||
]) | ||
|
||
<!-- Datepicker --> | ||
<div {{ $attributes->merge(['class' => 'input-group date']) }} data-provide="datepicker" data-date-today-highlight="true" data-date-language="{{ auth()->user()->locale }}" data-date-locale="{{ auth()->user()->locale }}" data-date-format="yyyy-mm-dd" data-date-autoclose="true" data-date-clear-btn="true"{{ $end_date ? ' data-date-end-date=' . $end_date : '' }}> | ||
<input type="text" {{ $attributes->merge(['class' => 'form-control']) }}> | ||
<span class="input-group-addon"><x-icon type="calendar" /></span> | ||
|
||
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<a href="#" data-tooltip="true" title="{{ $slot }}" style="padding-left: 0px;"> | ||
<x-icon type="more-info" style="font-size: 20px;" /> | ||
<span class="sr-only">{{ $slot }}</span> | ||
</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@props([ | ||
'item' => null, | ||
'field_name' => null, | ||
'input_style' => null, | ||
'required' => false, | ||
'disabled' => false, | ||
'name' => null, | ||
'label' => null, | ||
'value_text' => null, | ||
]) | ||
|
||
<label class="form-control{{ $disabled ? ' form-control--disabled' : '' }}"> | ||
<input type="radio" name="{{ $name }}" aria-label="{{ $name }}" @checked(old($name)) {!! $disabled ? 'class="disabled" disabled' : '' !!}> | ||
{{ $value_text ?? $label }} | ||
</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@props([ | ||
'input_style' => null, | ||
'input_group_addon' => null, | ||
'required' => false, | ||
'item' => null, | ||
]) | ||
<!-- input-text blade component --> | ||
<input | ||
{{ $attributes->merge(['class' => 'form-control', 'style' => $input_style]) }} | ||
@required($required) | ||
/> | ||
|
||
@if ($input_group_addon) | ||
<span class="input-group-addon">{{ $input_group_addon }}</span> | ||
@endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a
$attributes->merge(['class' =>
on the parentdiv
and theinput
makes me 🤔I noticed the same on
form-row
itself. I'm side-eyeing it but it seems to work fine.