From 7f0b782697feba60ab267145f271729451b23bc6 Mon Sep 17 00:00:00 2001 From: jimafisk Date: Tue, 24 Sep 2024 20:52:06 -0400 Subject: [PATCH] Reconfigure content directory (#342). --- defaults/core/cms/add_content.svelte | 9 +- defaults/core/cms/admin_menu.svelte | 30 +---- defaults/core/cms/modals/content_modal.svelte | 107 ++++++++++-------- 3 files changed, 68 insertions(+), 78 deletions(-) diff --git a/defaults/core/cms/add_content.svelte b/defaults/core/cms/add_content.svelte index a9a6bacf..36868556 100644 --- a/defaults/core/cms/add_content.svelte +++ b/defaults/core/cms/add_content.svelte @@ -3,11 +3,10 @@ import ButtonWrapper from './button_wrapper.svelte'; import validateFilename from './validate_filename.js'; - export let showAdd, showEditor, env; + export let showContentModal, showAdd, showEditor, env, selectedType; let filename = ""; let baseurl = env.baseurl ? env.baseurl : '/'; - let selectedType; const setType = type => { selectedType = type; } @@ -17,6 +16,7 @@ validationErrors = validateFilename(filename, selectedType); // No errors, redirect to "add" page if (validationErrors.length === 0) { + showContentModal = false; redirectAndEdit(baseurl + '#add/' + selectedType + '/' + filename); } } @@ -49,7 +49,10 @@ {/if} - + {:else}

Add content of type:

diff --git a/defaults/core/cms/admin_menu.svelte b/defaults/core/cms/admin_menu.svelte index 0a7f0985..7fd81689 100644 --- a/defaults/core/cms/admin_menu.svelte +++ b/defaults/core/cms/admin_menu.svelte @@ -1,6 +1,5 @@
-
-
active = 'listing'}> - - - - - - - Listing -
-
active = 'add'}> - - - - - - - Add New -
-
- {#if active === 'listing'} -

{title}:

-
- {#each filteredContent as c} - -
{c?.filename}
-
- - {c?.path} -
-
- {/each} + {#if showAdd && !env?.singleTypes?.includes(selectedType)} + + {:else} +
+ {#if !env?.singleTypes?.includes(selectedType)} + + {/if} + {#each filteredContent as c} + +
{c?.filename}
+
+ + {c?.path} +
+
+ {/each}
{/if} - {#if active === 'add'} - - {/if}
@@ -101,12 +93,14 @@ gap: 40px; } .plenti-column-1 { - flex-basis: 250px; + flex-basis: 0; + flex-grow: 1; border-right: 1px solid gainsboro; padding-right: 40px; } .plenti-column-2 { - flex-grow: 1; + flex-basis: 0; + flex-grow: 7; } button { width: 100%; @@ -116,6 +110,22 @@ border: 1px solid gainsboro; border-radius: 5px; margin: 6px 0; + cursor: pointer; + } + button.selected { + background-color: gainsboro; + } + button.add-new { + margin: 0; + font-size: initial; + border: 1px dashed; + display: flex; + align-items: center; + justify-content: center; + gap: 5px; + } + button.add-new:hover { + background-color: gainsboro; } .plenti-content-items { display: grid; @@ -123,6 +133,7 @@ gap: 10px; overflow-y: scroll; max-height: 100%; + word-break: break-all; } .plenti-content-item { text-decoration: none; @@ -137,4 +148,8 @@ align-content: center; gap: 4px; } + svg.icon-tabler-link { + min-width: 18px; + min-height: 18px; + } \ No newline at end of file