Skip to content

Commit

Permalink
default theme: Show nested fields' short names in UI, since we now …
Browse files Browse the repository at this point in the history
…indent
  • Loading branch information
shalvah committed Dec 5, 2022
1 parent 42df1b1 commit dbe8492
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion resources/views/components/field-details.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@if($isInput && empty($hasChildren))
@php
$isList = Str::endsWith($type, '[]');
$fullName =str_replace('[]', '.0', $name);
$fullName = str_replace('[]', '.0', $fullName ?? $name);
$baseType = $isList ? substr($type, 0, -2) : $type;
// Ignore the first '[]': the frontend will take care of it
while (\Str::endsWith($baseType, '[]')) {
Expand Down
12 changes: 8 additions & 4 deletions resources/views/components/nested-fields.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
@else
<div style="margin-left: {{ ($level + 2) * 14 }}px; clear: unset;">
@component('scribe::components.field-details', [
'name' => $subfield['name'],
'name' => $subfieldName,
'fullName' => $subfield['name'],
'type' => $subfield['type'] ?? 'string',
'required' => $subfield['required'] ?? false,
'description' => $subfield['description'] ?? '',
Expand All @@ -38,7 +39,8 @@
<details>
<summary style="padding-bottom: 10px;">
@component('scribe::components.field-details', [
'name' => $field['name'],
'name' => $name,
'fullName' => $field['name'],
'type' => $field['type'] ?? 'string',
'required' => $field['required'] ?? false,
'description' => $field['description'] ?? '',
Expand All @@ -58,7 +60,8 @@
@else
<div style="margin-left: {{ ($level + 1) * 14 }}px; clear: unset;">
@component('scribe::components.field-details', [
'name' => $subfield['name'],
'name' => $subfieldName,
'fullName' => $subfield['name'],
'type' => $subfield['type'] ?? 'string',
'required' => $subfield['required'] ?? false,
'description' => $subfield['description'] ?? '',
Expand All @@ -77,7 +80,8 @@
@else
<div style="@if($level) margin-left: {{ ($level + 1) * 14 }}px;@else padding-left: 28px; @endif clear: unset;">
@component('scribe::components.field-details', [
'name' => $field['name'],
'name' => $name,
'fullName' => $field['name'],
'type' => $field['type'] ?? 'string',
'required' => $field['required'] ?? false,
'description' => $field['description'] ?? '',
Expand Down

0 comments on commit dbe8492

Please sign in to comment.