From 26737ff3a751285d3b96a5c649d6083d23a9692c Mon Sep 17 00:00:00 2001 From: jimafisk Date: Fri, 27 Sep 2024 18:05:20 -0400 Subject: [PATCH] Make content rows consistent height (#342). --- defaults/core/cms/modals/content_modal.svelte | 65 +++++++++++-------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/defaults/core/cms/modals/content_modal.svelte b/defaults/core/cms/modals/content_modal.svelte index 019a1c45..7ac2e6f6 100644 --- a/defaults/core/cms/modals/content_modal.svelte +++ b/defaults/core/cms/modals/content_modal.svelte @@ -6,6 +6,14 @@ let selectedType = ""; let filteredContent = allContent; let showAdd = false; + + function truncate(str, maxLength) { + return str.length > maxLength ? str.slice(0, maxLength) + '...' : str; + } + function removeExtension(str, ext) { + const fullExt = ext.startsWith('.') ? ext : '.' + ext; + return str.endsWith(fullExt) ? str.slice(0, -fullExt.length) : str; + }
@@ -58,30 +66,32 @@ {#if showAdd && !env?.singleTypes?.includes(selectedType)} {:else} -
- {#if !env?.singleTypes?.includes(selectedType)} - - {/if} - {#each filteredContent as c} - -
{c?.filename}
-
- - {c?.path} -
-
- {/each} +
+
+ {#if !env?.singleTypes?.includes(selectedType)} + + {/if} + {#each filteredContent as c} + +
{truncate(removeExtension(c?.filename, ".json"), 28)}
+
+ + {truncate(c?.path, 32)} +
+
+ {/each} +
{/if}
@@ -128,12 +138,15 @@ background-color: gainsboro; } .plenti-content-items { + overflow-y: auto; + max-height: 100%; + } + .plenti-content-items-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; - overflow-y: scroll; - max-height: 100%; word-break: break-all; + grid-auto-rows: 1fr; } .plenti-content-item { text-decoration: none;