wip content index

This commit is contained in:
2024-10-01 22:31:07 +03:00
parent 39e7a3aed4
commit fa388ea302
21 changed files with 356 additions and 22 deletions
@@ -0,0 +1,42 @@
<dialog id="dialog-{{$schema->name}}">
@if($schema)
<div class="dialog-header">
<button
type="button"
class="button"
disabled
>
Insert
</button>
<button
type="button"
class="button"
disabled
>
Replace
</button>
<div class="hide">
<span class="number-of-records-selected"></span> records selected
</div>
<button
type="button"
class="button close"
aria-label="Close"
>
<x-lucent::icon icon="close">
</x-lucent::icon>
</button>
</div>
<div class="dialog-body">
@include("lucent::records.index")
</div>
@endif
</dialog>
@@ -18,5 +18,6 @@
@include("lucent::records-editor.fields", ["field" => $field])
@endforeach
</div>
@endsection
@@ -1,16 +1,31 @@
@php
$references = $graph->edges
->filter(fn($edge) => $edge->field === $field->name && $edge->source === $record->id)
->map(fn($edge) => $graph->records->firstWhere("id", $edge->target));
$references = $graph->edges
->filter(fn($edge) => $edge->field === $field->name && $edge->source === $record->id)
->map(fn($edge) => $graph->records->firstWhere("id", $edge->target));
$collectionSchemas = $schemas->whereIn("name",$field->collections);
@endphp
@if ($references->isNotEmpty())
{{--<Sortable sortableClass="mt-3" on:update={reorder}>--}}
@foreach($references as $reference)
<!--This div helps the sorting thing-->
<div>
@include("lucent::records-editor.fields.file.preview")
</div>
@endforeach
<!--</Sortable>-->
@if(count($field->collections) === 1)
<button class="button" data-open-modal="{{$field->collections[0]}}">Browse</button>
@else
<x-lucent::dropdown>
Browse
<x-slot:items>
@foreach($collectionSchemas as $collectionSchema)
<a class="dropdown-item" data-open-modal="{{$collectionSchema->name}}" href="/">{{$collectionSchema->label}}</a>
@endforeach
</x-slot:items>
</x-lucent::dropdown>
@endif
@if ($references->isNotEmpty())
<div class="sortable-container mt-3">
@foreach($references as $reference)
<!--This div helps the sorting thing-->
<div>
@include("lucent::records-editor.fields.file.preview", ["record" => $reference])
</div>
@endforeach
</div>
@endif
@@ -1,16 +1,17 @@
@php
$schema = $channel->schemas->firstWhere("name",$reference->schema);
$reference = $record;
$schema = $channel->schemas->firstWhere("name",$record->schema);
@endphp
<div class="preview-file">
<div style="display: flex;align-items: center;gap: 10px;">
<div class="image">
@include("lucent::records-editor.fields.file.thumb", ["size" => "small", "record" => $reference])
@include("lucent::records-editor.fields.file.thumb", ["size" => "small"])
</div>
<div class="title">
<div>
<a class="record-title" href="{{lucent_url("records")}}/{{$record->id}}">
{{$viewModel->getRecordName($reference)}}
{{$viewModel->getRecordName($record)}}
</a>
<small class="d-block">
from {{$schema->label}}