Skip to content

Commit bf42132

Browse files
authored
Add toggle to JSON
1 parent d1dcff1 commit bf42132

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/resources/views/crud/columns/json.blade.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
$column['suffix'] = $column['suffix'] ?? '';
77
$column['wrapper']['element'] = $column['wrapper']['element'] ?? 'pre';
88
$column['text'] = $column['default'] ?? '-';
9+
$column['toggle'] = $column['toggle'] ?? false;
10+
11+
if ($column['toggle']) {
12+
$column['wrapper']['class'] = 'd-none mt-2';
13+
}
914
1015
if(is_string($column['value'])) {
1116
$column['value'] = json_decode($column['value'], true);
@@ -20,6 +25,9 @@
2025
}
2126
@endphp
2227

28+
@if ($column['toggle'])
29+
<button type="button" class="btn btn-sm btn-info" onclick="this.nextElementSibling.classList.toggle('d-none');this.textContent=='Show'?this.textContent='Hide':this.textContent='Show'">Show</button>
30+
@endif
2331
@includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start')
2432
@if($column['escaped'])
2533
{{ $column['text'] }}

0 commit comments

Comments
 (0)