-
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set examples for nested file parameters properly
- Loading branch information
Showing
4 changed files
with
87 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,36 +1,59 @@ | ||
<b><code>{{ $name }}</code></b> @if($type)<small>{{ $type }}</small>@endif @if(!$required) | ||
<i>optional</i>@endif | ||
@if(($isInput ?? true) && empty($hasChildren)) | ||
@php | ||
$isList = Str::endsWith($type, '[]'); | ||
$fullName =str_replace('[]', '.0', $name); | ||
$baseType = $isList ? substr($type, 0, -2) : $type; | ||
// Ignore the first '[]': the frontend will take care of it | ||
while (\Str::endsWith($baseType, '[]')) { | ||
$fullName .= '.0'; | ||
$baseType = substr($baseType, 0, -2); | ||
} | ||
switch($baseType) { | ||
case 'number': | ||
case 'integer': | ||
$inputType = 'number'; | ||
break; | ||
case 'file': | ||
$inputType = 'file'; | ||
break; | ||
default: | ||
$inputType = 'text'; | ||
} | ||
@endphp | ||
@if($type === 'boolean') | ||
<label data-endpoint="{{ $endpointId }}" hidden><input type="radio" name="{{ $fullName }}" value="{{$component === 'body' ? 'true' : 1}}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif><code>true</code></label> | ||
<label data-endpoint="{{ $endpointId }}" hidden><input type="radio" name="{{ $fullName }}" value="{{$component === 'body' ? 'false' : 0}}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif><code>false</code></label> | ||
@elseif($isList) | ||
<input type="{{ $inputType }}" name="{{ $fullName.".0" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden> | ||
<input type="{{ $inputType }}" name="{{ $fullName.".1" }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" hidden> | ||
@else | ||
<input type="{{ $inputType }}" name="{{ $fullName }}" data-endpoint="{{ $endpointId }}" data-component="{{ $component }}" @if($required)required @endif hidden> | ||
@endif | ||
@php | ||
$isList = Str::endsWith($type, '[]'); | ||
$fullName =str_replace('[]', '.0', $name); | ||
$baseType = $isList ? substr($type, 0, -2) : $type; | ||
// Ignore the first '[]': the frontend will take care of it | ||
while (\Str::endsWith($baseType, '[]')) { | ||
$fullName .= '.0'; | ||
$baseType = substr($baseType, 0, -2); | ||
} | ||
switch($baseType) { | ||
case 'number': | ||
case 'integer': | ||
$inputType = 'number'; | ||
break; | ||
case 'file': | ||
$inputType = 'file'; | ||
break; | ||
default: | ||
$inputType = 'text'; | ||
} | ||
@endphp | ||
@if($type === 'boolean') | ||
<label data-endpoint="{{ $endpointId }}" hidden> | ||
<input type="radio" name="{{ $fullName }}" | ||
value="{{$component === 'body' ? 'true' : 1}}" | ||
data-endpoint="{{ $endpointId }}" | ||
data-component="{{ $component }}" @if($required)required @endif | ||
> | ||
<code>true</code> | ||
</label> | ||
<label data-endpoint="{{ $endpointId }}" hidden> | ||
<input type="radio" name="{{ $fullName }}" | ||
value="{{$component === 'body' ? 'false' : 0}}" | ||
data-endpoint="{{ $endpointId }}" | ||
data-component="{{ $component }}" @if($required)required @endif | ||
> | ||
<code>false</code> | ||
</label> | ||
@elseif($isList) | ||
<input type="{{ $inputType }}" | ||
name="{{ $fullName.".0" }}" | ||
data-endpoint="{{ $endpointId }}" | ||
data-component="{{ $component }}" @if($required)required @endif hidden> | ||
<input type="{{ $inputType }}" | ||
name="{{ $fullName.".1" }}" | ||
data-endpoint="{{ $endpointId }}" | ||
data-component="{{ $component }}" hidden> | ||
@else | ||
<input type="{{ $inputType }}" | ||
name="{{ $fullName }}" | ||
data-endpoint="{{ $endpointId }}" | ||
data-component="{{ $component }}" @if($required)required @endif hidden> | ||
@endif | ||
@endif | ||
<br> | ||
{!! Parsedown::instance()->text($description) !!} |
This file contains 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 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