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="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}/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {getStatus, getStatusList} from "../StatusText.js";
|
||||
import SwitchButton from "../../common/SwitchButton.svelte";
|
||||
|
||||
export let status = "draft";
|
||||
let dropdown;
|
||||
@@ -11,37 +12,53 @@
|
||||
status = statusValue;
|
||||
dropdown.click();
|
||||
}
|
||||
|
||||
function switchStatus(e){
|
||||
console.log("Asf")
|
||||
if(currentStatus.value === "draft"){
|
||||
status = "published"
|
||||
}
|
||||
|
||||
if(currentStatus.value === "published"){
|
||||
status = "draft"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{#if status}
|
||||
<!-- Example split danger button -->
|
||||
<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 class="form-check form-switch" >
|
||||
<input on:click={switchStatus} class="form-check-input" type="checkbox" role="switch" id="record-status-switch" checked={status === "published"}>
|
||||
<label class="form-check-label" for=record-status-switch>{currentStatus.text}</label>
|
||||
</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}
|
||||
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\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
use Lucent\Support\Option\Option;
|
||||
|
||||
class NewDocumentData
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class NewDocumentData
|
||||
public function __construct(
|
||||
public string $schemaName,
|
||||
public array $data,
|
||||
public Option $id,
|
||||
public Option $id,
|
||||
public Collection $edges,
|
||||
public Status $status = Status::DRAFT,
|
||||
)
|
||||
|
||||
@@ -320,7 +320,6 @@ class RecordController extends Controller
|
||||
field: $item["field"],
|
||||
data: Option::fromValue(data_get($item, "data")),
|
||||
));
|
||||
|
||||
$res = match ($request->input("isCreateMode")) {
|
||||
true => $this->recordService->createDocument(new NewDocumentData(
|
||||
schemaName: $request->input("schemaName"),
|
||||
|
||||
@@ -44,13 +44,13 @@ class SidebarService
|
||||
);
|
||||
})->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(
|
||||
label: $sidebar->isDefined() ? "Rest" : "Content",
|
||||
isOpen: $schemas->whereNotIn("name",$usedSchemaNames)->where("name",$currentSchema)->isNotEmpty(),
|
||||
items: array_map(fn($item) => $this->renderItem($currentSchema, $item), $schemas->whereNotIn("name",$usedSchemaNames)->toArray())
|
||||
isOpen: $schemas->whereNotIn("name", $usedSchemaNames)->where("name", $currentSchema)->isNotEmpty(),
|
||||
items: array_map(fn($item) => $this->renderItem($currentSchema, $item), $schemas->whereNotIn("name", $usedSchemaNames)->toArray())
|
||||
);
|
||||
|
||||
return view('lucent::sidebar.sidebar', [
|
||||
@@ -61,6 +61,7 @@ class SidebarService
|
||||
|
||||
private function renderItem(string $currentSchema, Item|Schema $item): ItemData
|
||||
{
|
||||
|
||||
return match (get_class($item)) {
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user