diff --git a/config/lucent.php b/config/lucent.php index 83af640..a7e36cb 100644 --- a/config/lucent.php +++ b/config/lucent.php @@ -45,5 +45,15 @@ return [ \Lucent\Schema\Ui\Slug::class, \Lucent\Schema\Ui\Text::class, \Lucent\Schema\Ui\Textarea::class + ], + "renderers" => [ + "row" => [ + "file" => \Lucent\Schema\Renderer\Row\File::class, + "slug" => \Lucent\Schema\Renderer\Row\Text::class, + "text" => \Lucent\Schema\Renderer\Row\Text::class, + "checkbox" => \Lucent\Schema\Renderer\Row\Text::class, + "number" => \Lucent\Schema\Renderer\Row\Text::class, + "rich" => \Lucent\Schema\Renderer\Row\Text::class, + ] ] ]; diff --git a/front/js/main.js b/front/js/main.js index 9210a6b..708db98 100644 --- a/front/js/main.js +++ b/front/js/main.js @@ -6,10 +6,14 @@ import Mustache from "mustache"; import 'htmx.org'; import {dropdown} from "./components/dropdown.js"; import {colorPicker} from "./recordEditor/colorPicker.js"; +import {sortReferences} from "./recordEditor/sortReferences.js"; +import {recordDialog} from "./recordEditor/recordDialog.js"; addEventListener("load", (event) => { dropdown() colorPicker() + sortReferences() + recordDialog() }); Mustache.escape = function (value) { diff --git a/front/js/recordEditor/recordDialog.js b/front/js/recordEditor/recordDialog.js new file mode 100644 index 0000000..02c511d --- /dev/null +++ b/front/js/recordEditor/recordDialog.js @@ -0,0 +1,32 @@ +import axios from "axios"; + +export function recordDialog() { + + document.querySelectorAll("[data-open-modal]").forEach(el => { + const schema = el.dataset.openModal + el.addEventListener("click", e => { + load(schema) + }) + }) +} + + +function load(schema) { + axios + .get("/lucent/content/" + schema) + .then((response) => { + + const dialogWrapperEl = document.createElement("div"); + dialogWrapperEl.innerHTML = response.data; + document.body.appendChild(dialogWrapperEl); + const dialogEl = dialogWrapperEl.querySelector("dialog"); + dialogEl.showModal(); + dialogWrapperEl.querySelector(".close").addEventListener("click", e => dialogEl.close()); + + dialogEl.addEventListener("close", (event) => { + dialogWrapperEl.remove(); + }); + }) + .catch((error) => console.log(error)); +} + diff --git a/front/js/recordEditor/sortReferences.js b/front/js/recordEditor/sortReferences.js new file mode 100644 index 0000000..4802360 --- /dev/null +++ b/front/js/recordEditor/sortReferences.js @@ -0,0 +1,19 @@ +import Sortable from "sortablejs"; +export function sortReferences() { + document.querySelectorAll(".color-picker").forEach(el => { + + let options = { + animation: 150, // ms, animation speed moving items when sorting, `0` — without animation + easing: "cubic-bezier(1, 0, 0, 1)", + direction: 'vertical', + onUpdate: function (/**Event*/ evt) { + // dispatch("update", { + // source: evt.oldIndex, + // target: evt.newIndex, + // }); + } + }; + + Sortable.create(el, options); + }) +} diff --git a/front/js/svelte/content/elements/Rich.svelte b/front/js/svelte/content/elements/Rich.svelte index 15dcfe0..dd9a068 100644 --- a/front/js/svelte/content/elements/Rich.svelte +++ b/front/js/svelte/content/elements/Rich.svelte @@ -11,7 +11,8 @@ /* max-width: 128px; */ max-height: 24px; text-overflow: ellipsis; - /* white-space: nowrap; */ overflow: hidden; + /* white-space: nowrap; */ + } diff --git a/front/sass/_table.scss b/front/sass/_table.scss index d7f1bd4..8cdf57b 100644 --- a/front/sass/_table.scss +++ b/front/sass/_table.scss @@ -55,7 +55,11 @@ border: none; overflow: hidden; - + &.field-ui-number,&.field-ui-slug,&.field-ui-text,&.field-ui-rich,&.field-ui-url{ + max-height: 24px; + text-overflow: ellipsis; + overflow: hidden; + } //img{ // width: 48px; //} diff --git a/front/views/components/avatar.blade.php b/front/views/components/avatar.blade.php index a887a45..e5cff28 100644 --- a/front/views/components/avatar.blade.php +++ b/front/views/components/avatar.blade.php @@ -28,7 +28,7 @@ return strtoupper($segs[0][0]).strtoupper($segs[0][1]); }; - $name = $user["name"]; + $name = (string)data_get($user,"name"); $charIndex = ord($name[1]) + strlen($name); $colorIndex = $charIndex % 19; $bgColor = $colors[$colorIndex]; @@ -39,5 +39,5 @@ title="{{$name}}" style="background-color:{{$bgColor}};height: {{$side}}px;width: {{$side}}px; font-size:{{$side / 2}}px" > -
|
+ |
+ @endif
+ @foreach($schema->visible as $visibleColumn)
+ @php
+ $schemaField = $schema->fields->firstWhere("name", $visibleColumn);
+ if(empty($schemaField)){
+ $schemaField = collect($systemFields)->firstWhere("name", str_replace("_sys.", "",$visibleColumn) );
+ }
+ @endphp
+ help ?? ""}} + >{{$schemaField->label}} | + @endforeach ++ |
|---|---|---|
|
+
+ @if($isWritable)
+
+
+ @include("lucent::records-editor.fields.file.thumb", ["size" => "small"])
+
+ @else
+ id}}"
+ target={{$inModal ? "_blank" : "_self"}}
+ >
+ @if($record->status === "draft")
+ {{$record->status}}
+ @endif
+ {{$viewModel->getRecordName($record)}}
+
+ @endif
+
+ @if($record->status === "draft")
+ {{$record->status}}
+ @endif
+ id}}"
+ target={{$inModal ? "_blank" : "_self"}}
+ >
+ {{ $viewModel->getRecordName($record)}}
+
+ {{ (int)($record->_file->size / 1024) }}kB
+
+ @if($record->_file->width > 0)
+ {{$record->_file->width . "x" . $record->_file->height}}
+ @endif
+
+ Download
+
+
+
+ |
+ @include("lucent::records.row")
+
+ |
+