Skip to content

Commit

Permalink
Update: Add filter option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Aug 29, 2023
1 parent bf0f0d0 commit 494a49e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Resources/Private/Fusion/Component/ByAsset.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ prototype(Garagist.ImageDirectory:ByAsset) < prototype(Neos.Fusion:Component) {
ignoreAssets = ${q(this.node).property('imageDirectoryIgnoreAssets')}
ignoreDocuments = ${q(this.node).property('imageDirectoryIgnoreDocuments')}

filter = '[!instanceof Neos.Neos:Shortcut]'

renderer = Neos.Fusion:Map {
@process.filter = ${Array.filter(value)}
items = ${props.rawList}
Expand All @@ -33,7 +35,7 @@ prototype(Garagist.ImageDirectory:ByAsset) < prototype(Neos.Fusion:Component) {
@process.filter = ${Array.filter(value)}
items = ${item.documents}
itemRenderer = Garagist.ImageDirectory:Helper.DocumentDataStructure {
@if.notIgnore = ${Array.indexOf(props.ignoreDocuments || [], item.node) == -1 || false}
@if.notIgnore = ${(props.filter ? q(item.node).is(props.filter) : true) && Array.indexOf(props.ignoreDocuments || [], item.node) == -1 || false}
document = ${item}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Resources/Private/Fusion/Component/ByDocument.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ prototype(Garagist.ImageDirectory:ByDocument) < prototype(Neos.Fusion:Component)
ignoreAssets = ${q(this.node).property('imageDirectoryIgnoreAssets')}
ignoreDocuments = ${q(this.node).property('imageDirectoryIgnoreDocuments')}

filter = '[!instanceof Neos.Neos:Shortcut]'

renderer = Neos.Fusion:Map {
@process.filter = ${Array.filter(value)}
items = ${Array.filter(props.rawList, item => Array.indexOf(props.ignoreDocuments || [], item.node) == -1)}
items = ${Array.filter(props.rawList, item => (props.filter ? q(item.node).is(props.filter) : true) && Array.indexOf(props.ignoreDocuments || [], item.node) == -1)}
itemRenderer = Garagist.ImageDirectory:Helper.DocumentDataStructure {
@if.hasAssets = ${Array.length(this.assets)}
document = ${item}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Fusion/Helper/RawList.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ prototype(Garagist.ImageDirectory:Helper.RawList) {
mediaTypes = 'image/*,video/*'

# Comma seperated list
filter = 'Neos.Neos:Document,!Neos.Neos:Shortcut'
filter = 'Neos.Neos:Document'
}

0 comments on commit 494a49e

Please sign in to comment.