stuff
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
import {uniqueId} from "lodash";
|
||||||
|
|
||||||
|
export let label = "";
|
||||||
|
let id = uniqueId();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id={id} checked>
|
||||||
|
<label class="form-check-label" for={id}>{label}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<div class="record-status-bar">
|
<div class="record-status-bar">
|
||||||
<div
|
<div
|
||||||
class="d-flex mt-3 mb-3 align-items-center justify-content-center"
|
class="d-flex mt-3 mb-3 align-items-center justify-content-between"
|
||||||
>
|
>
|
||||||
|
|
||||||
<StatusSelect bind:status={status}/>
|
<StatusSelect bind:status={status}/>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getStatus, getStatusList} from "../StatusText.js";
|
import {getStatus, getStatusList} from "../StatusText.js";
|
||||||
|
import SwitchButton from "../../common/SwitchButton.svelte";
|
||||||
|
|
||||||
export let status = "draft";
|
export let status = "draft";
|
||||||
let dropdown;
|
let dropdown;
|
||||||
@@ -11,37 +12,53 @@
|
|||||||
status = statusValue;
|
status = statusValue;
|
||||||
dropdown.click();
|
dropdown.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function switchStatus(e){
|
||||||
|
console.log("Asf")
|
||||||
|
if(currentStatus.value === "draft"){
|
||||||
|
status = "published"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentStatus.value === "published"){
|
||||||
|
status = "draft"
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{#if status}
|
{#if status}
|
||||||
<!-- Example split danger button -->
|
<!-- Example split danger button -->
|
||||||
<div class="d-flex justify-content-between">
|
<div class="form-check form-switch" >
|
||||||
<div class="btn-group dropup">
|
<input on:click={switchStatus} class="form-check-input" type="checkbox" role="switch" id="record-status-switch" checked={status === "published"}>
|
||||||
<button type="button" class="btn btn-{currentStatus.bg}"
|
<label class="form-check-label" for=record-status-switch>{currentStatus.text}</label>
|
||||||
>{currentStatus.text}</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
bind:this={dropdown}
|
|
||||||
type="button"
|
|
||||||
class="btn btn-{currentStatus.bg} dropdown-toggle dropdown-toggle-split"
|
|
||||||
data-bs-toggle="dropdown"
|
|
||||||
aria-expanded="false"
|
|
||||||
>
|
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<div class="dropdown-header">Change status to</div>
|
|
||||||
{#each statusList as astatus}
|
|
||||||
{#if astatus.value !== status}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="dropdown-item my-2 rounded w-100 bg-{astatus.bg} text-{astatus.color}"
|
|
||||||
on:click={(e) => updateStatus(e, astatus.value)}
|
|
||||||
>
|
|
||||||
{astatus.text}
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="d-flex justify-content-between">-->
|
||||||
|
<!-- <div class="btn-group dropup">-->
|
||||||
|
<!-- <button type="button" class="btn btn-{currentStatus.bg}"-->
|
||||||
|
<!-- >{currentStatus.text}</button-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <button-->
|
||||||
|
<!-- bind:this={dropdown}-->
|
||||||
|
<!-- type="button"-->
|
||||||
|
<!-- class="btn btn-{currentStatus.bg} dropdown-toggle dropdown-toggle-split"-->
|
||||||
|
<!-- data-bs-toggle="dropdown"-->
|
||||||
|
<!-- aria-expanded="false"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <span class="visually-hidden">Toggle Dropdown</span>-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<!-- <div class="dropdown-menu">-->
|
||||||
|
<!-- <div class="dropdown-header">Change status to</div>-->
|
||||||
|
<!-- {#each statusList as astatus}-->
|
||||||
|
<!-- {#if astatus.value !== status}-->
|
||||||
|
<!-- <button-->
|
||||||
|
<!-- type="button"-->
|
||||||
|
<!-- class="dropdown-item my-2 rounded w-100 bg-{astatus.bg} text-{astatus.color}"-->
|
||||||
|
<!-- on:click={(e) => updateStatus(e, astatus.value)}-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- {astatus.text}-->
|
||||||
|
<!-- </button>-->
|
||||||
|
<!-- {/if}-->
|
||||||
|
<!-- {/each}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
{/if}
|
{/if}
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "lucent-package",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ namespace Lucent\Graph\Record\Contracts;
|
|||||||
|
|
||||||
use Lucent\Graph\Record\Status;
|
use Lucent\Graph\Record\Status;
|
||||||
use Lucent\Support\Collection;
|
use Lucent\Support\Collection;
|
||||||
use PhpOption\Option;
|
use Lucent\Support\Option\Option;
|
||||||
|
|
||||||
class NewDocumentData
|
class NewDocumentData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -320,7 +320,6 @@ class RecordController extends Controller
|
|||||||
field: $item["field"],
|
field: $item["field"],
|
||||||
data: Option::fromValue(data_get($item, "data")),
|
data: Option::fromValue(data_get($item, "data")),
|
||||||
));
|
));
|
||||||
|
|
||||||
$res = match ($request->input("isCreateMode")) {
|
$res = match ($request->input("isCreateMode")) {
|
||||||
true => $this->recordService->createDocument(new NewDocumentData(
|
true => $this->recordService->createDocument(new NewDocumentData(
|
||||||
schemaName: $request->input("schemaName"),
|
schemaName: $request->input("schemaName"),
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ class SidebarService
|
|||||||
);
|
);
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$usedSchemaNames =$sidebar->get()->sections->reduce(fn(array $carry, Section $section) => array_merge($carry, $section->items->pluck("schema")->toArray()), []);
|
$usedSchemaNames = $sidebar->get()->sections->reduce(fn(array $carry, Section $section) => array_merge($carry, $section->items->pluck("schema")->toArray()), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sections[] = new SectionData(
|
$sections[] = new SectionData(
|
||||||
label: $sidebar->isDefined() ? "Rest" : "Content",
|
label: $sidebar->isDefined() ? "Rest" : "Content",
|
||||||
isOpen: $schemas->whereNotIn("name",$usedSchemaNames)->where("name",$currentSchema)->isNotEmpty(),
|
isOpen: $schemas->whereNotIn("name", $usedSchemaNames)->where("name", $currentSchema)->isNotEmpty(),
|
||||||
items: array_map(fn($item) => $this->renderItem($currentSchema, $item), $schemas->whereNotIn("name",$usedSchemaNames)->toArray())
|
items: array_map(fn($item) => $this->renderItem($currentSchema, $item), $schemas->whereNotIn("name", $usedSchemaNames)->toArray())
|
||||||
);
|
);
|
||||||
|
|
||||||
return view('lucent::sidebar.sidebar', [
|
return view('lucent::sidebar.sidebar', [
|
||||||
@@ -61,6 +61,7 @@ class SidebarService
|
|||||||
|
|
||||||
private function renderItem(string $currentSchema, Item|Schema $item): ItemData
|
private function renderItem(string $currentSchema, Item|Schema $item): ItemData
|
||||||
{
|
{
|
||||||
|
|
||||||
return match (get_class($item)) {
|
return match (get_class($item)) {
|
||||||
LinkItem::class => new ItemData($item->label, $item->href, false, true),
|
LinkItem::class => new ItemData($item->label, $item->href, false, true),
|
||||||
SchemaItem::class => new ItemData($item->label, $this->channelService->channel->lucentUrl . "/content/" . $item->schema, $currentSchema === $item->schema, false),
|
SchemaItem::class => new ItemData($item->label, $this->channelService->channel->lucentUrl . "/content/" . $item->schema, $currentSchema === $item->schema, false),
|
||||||
|
|||||||
Reference in New Issue
Block a user