Skip to content

Commit

Permalink
laravel7.0.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
corbinjurgens committed Feb 14, 2022
1 parent 5205376 commit 11a96eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/resources/views/input-array.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--}}
<div id="json-{{ $attributes->get('id', $id_fallback) }}" class="json-input-element" data-errors="{{ json_encode($errors) }}" data-json="{{ is_object($value) ? $value->toJson() : json_encode($value) }}" data-mode="{{ is_string($value) ? 'string' : 'array' }}" >
<div class="json-pre scope-container-pre"></div>
<div class="json-content scope-item scope-max scope-container row" data-type="{{ $alt_type ?? $type }}" data-title="{{ $title }}" data-name="{{ $name }}" aria-labelledby="label-{{ $attributes->get('id', $id_fallback) }}" aria-describedby="{{ $attributes->get('id', $id_fallback) }}-help" role="group" data-required="{{ $attributes->has('required') ? '1' : ''}}"></div>
<div class="json-content scope-item scope-max scope-container row" data-type="{{ $alt_type ?? $type }}" data-title="{{ $title }}" data-name="{{ $name }}" aria-labelledby="label-{{ $attributes->get('id', $id_fallback) }}" aria-describedby="{{ $attributes->get('id', $id_fallback) }}-help" role="group" data-required="{{ $attributes->get('required') ? '1' : ''}}"></div>
<div class="json-post scope-container-post"></div>
{{-- .json-input-element #json-$name use handlebars or other script to display content here --}}
</div>
16 changes: 13 additions & 3 deletions src/resources/views/input-attr.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@if ((isset($loop) && $loop->first) || (!isset($loop)))
@if ($attributes->has('required')) required @endif
aria-required="{{ $attributes->has('required') ? 'true' : 'false' }}"
@if ($attributes->get('required')) required @endif
aria-required="{{ $attributes->get('required') ? 'true' : 'false' }}"
aria-invalid="{{ $error ? 'true' : 'false' }}"
@endif

Expand All @@ -18,4 +18,14 @@
@if(!$hide)value="{{ $value }}"@endif
@if(($aria_describedby ?? null) !== false)aria-describedby="{{ ($aria_describedby ?? null) ? $aria_describedby : $attributes->get('id', $id_fallback) }}-help"@endif

{{ $attributes->class(['input-' . $basename, 'required' => $attributes->has('required'), $class ?? '' => isset($class)])->merge(['id' => 'input-' . $id_fallback]) }}
@php
// $attributes class function not in older versions
if ($attributes->get('required') == true){
$attributes = $attributes->merge(['class' => 'required']);
}
if (isset($class)){
$attributes = $attributes->merge(['class' => $class]);
}
$attributes = $attributes->merge(['class' => 'input-' . $basename, 'id' => 'input-' . $id_fallback]);
@endphp
{{ $attributes }}
2 changes: 1 addition & 1 deletion src/resources/views/label-postfix.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@if ($attributes->has('required')) <span class="text-danger">*</span>@endif
@if ($attributes->get('required')) <span class="text-danger">*</span>@endif

0 comments on commit 11a96eb

Please sign in to comment.