-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1395 from plone/petschki-contentbrowser-enhancements
`pat-contentbrowser` fixes
- Loading branch information
Showing
10 changed files
with
265 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script> | ||
import { resolveIcon } from "./utils"; | ||
import _t from "../../../core/i18n-wrapper"; | ||
import { createEventDispatcher, getContext } from "svelte"; | ||
const config = getContext("config"); | ||
const dispatch = createEventDispatcher(); | ||
function select(item) { | ||
dispatch("selectItem", { | ||
item: item, | ||
}); | ||
} | ||
</script> | ||
|
||
{#if $config?.favorites} | ||
<div class="favorites dropdown dropdown-menu-end ms-2"> | ||
<button | ||
type="button" | ||
class="favorites dropdown-toggle btn btn-outline-light btn-sm" | ||
data-bs-toggle="dropdown" | ||
aria-haspopup="true" | ||
aria-expanded="false" | ||
> | ||
<svg use:resolveIcon={{ iconName: "star-fill" }} /> | ||
{_t("Favorites")} | ||
</button> | ||
<ul class="dropdown-menu"> | ||
{#each $config.favorites as favorite} | ||
<li> | ||
<a class="dropdown-item" href="{favorite.path}" on:click|preventDefault={() => select(favorite)}>{favorite.title}</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script> | ||
import { resolveIcon, recentlyUsedItems } from "./utils"; | ||
import _t from "../../../core/i18n-wrapper"; | ||
import { createEventDispatcher, getContext } from "svelte"; | ||
const config = getContext("config"); | ||
const items = recentlyUsedItems(true, $config); | ||
const dispatch = createEventDispatcher(); | ||
function select(item) { | ||
dispatch("selectItem", { | ||
item: item, | ||
}); | ||
} | ||
</script> | ||
|
||
{#if $config.recentlyUsed && items.length} | ||
<div class="recentlyUsed dropdown ms-2"> | ||
<button | ||
type="button" | ||
class="recentlyUsed dropdown-toggle btn btn-outline-light btn-sm" | ||
data-bs-toggle="dropdown" | ||
aria-haspopup="true" | ||
aria-expanded="false" | ||
> | ||
<svg use:resolveIcon={{ iconName: "grid-fill" }} /> | ||
{_t("Recently Used")} | ||
</button> | ||
<ul class="dropdown-menu"> | ||
{#each items.reverse() as recentlyUsed} | ||
<li> | ||
<a | ||
href={recentlyUsed.getURL} | ||
on:click|preventDefault={() => select(recentlyUsed)} | ||
class="dropdown-item" | ||
> | ||
<svg | ||
on:error={console.log(recentlyUsed)} | ||
use:resolveIcon={{ | ||
iconName: `contenttype/${recentlyUsed?.portal_type.toLowerCase().replace(/\.| /g, "-")}`, | ||
}} | ||
/> | ||
{recentlyUsed.Title} | ||
</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</div> | ||
{/if} |
Oops, something went wrong.