Skip to content

Commit 824fa38

Browse files
authored
Merge pull request #1439 from plone/contentbrowser-initialpath-fix
Fix selecting current path when opening `pat-contentbrowser` initially
2 parents 81ae4f4 + 5e45332 commit 824fa38

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/pat/contentbrowser/src/App.svelte

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,24 @@
5252
const currentPath = getContext("currentPath");
5353
5454
if (!$currentPath) {
55-
if(basePath || rootPath) {
55+
if (basePath || rootPath) {
5656
// if root path is not above base path we start at rootPath
5757
$currentPath = basePath.indexOf(rootPath) != 0 ? rootPath : basePath;
58+
if (
59+
rootPath &&
60+
$currentPath != rootPath &&
61+
$currentPath.indexOf(rootPath) == 0
62+
) {
63+
// remove rootPath from $currentPath
64+
$currentPath = $currentPath.replace(rootPath, "");
65+
}
5866
} else {
5967
// no path available. try to determine path from vocabularyUrl
6068
const vocabPath = new URL(vocabularyUrl).pathname.split("/");
61-
rootPath = contextPath = $currentPath = vocabPath.slice(0, vocabPath.length - 1).join("/") || "/";
69+
rootPath =
70+
contextPath =
71+
$currentPath =
72+
vocabPath.slice(0, vocabPath.length - 1).join("/") || "/";
6273
}
6374
}
6475

src/pat/contentbrowser/src/ContentBrowser.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@
598598
class={gridView
599599
? "grid-preview"
600600
: "item-title"}
601-
title="{item.portal_type}: {item.Title}"
601+
title="{item.path}: {item.Title}"
602602
>
603603
{#if gridView && item.getIcon}
604604
<img
@@ -834,7 +834,7 @@
834834
}
835835
.levelToolbar {
836836
width: 100%;
837-
height: 2.5rem;
837+
min-height: 2.5rem;
838838
display: flex;
839839
justify-content: space-between;
840840
white-space: nowrap;

0 commit comments

Comments
 (0)