Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle tethered nodes #68

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Classes/Command/TaxonomyCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public function taxonomiesCommand(string $vocabulary, string $path = ''): void
if (!$startPoint) {
$this->outputLine('nothing found');
$this->quit(1);
throw new StopCommandException();
}

$subtree = $this->taxonomyService->findSubtree($startPoint);
Expand Down
10 changes: 5 additions & 5 deletions Classes/Service/TaxonomyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\NodeType\NodeTypeNames;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindAncestorNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindSubtreeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
Expand Down Expand Up @@ -81,18 +81,18 @@ public function findVocabularyForNode(Node $node): Node
{
$subgraph = $this->crRegistry->subgraphForNode($node);

$ancestors = $subgraph->findAncestorNodes(
$vocabularyNode = $subgraph->findClosestNode(
$node->nodeAggregateId,
FindAncestorNodesFilter::create(
FindClosestNodeFilter::create(
nodeTypes: NodeTypeCriteria::create(
NodeTypeNames::fromArray([ $this->getVocabularyNodeTypeName()]),
NodeTypeNames::createEmpty()
)
)
);

if ($result = $ancestors->first()) {
return $result;
if ($vocabularyNode) {
return $vocabularyNode;
}

throw new \InvalidArgumentException('node seems to be outside of vocabulary');
Expand Down
7 changes: 6 additions & 1 deletion Resources/Private/Fusion/Backend/Form/Taxonomy.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ prototype(Sitegeist.Taxonomy:Form.Taxonomy) < prototype(Neos.Fusion:Component) {
{props.i18nTaxonomy.id('properties.name')}
<span @if={props.defaultTaxonomy}>: {props.defaultTaxonomy.properties.name}</span>
</label>
<Neos.Fusion.Form:Input attributes.class="neos-span6" field.name="name" attributes.required attributes.pattern="[a-z0-9]+" />
<Neos.Fusion.Form:Input
attributes.class="neos-span6"
field.name="name"
attributes.required attributes.pattern="[a-z0-9]+"
attributes.disabled="1" attributes.disabled.@if={props.taxonomyNode.classification.value == 'tethered'}
/>
</div>

<div class="neos-control-group">
Expand Down
8 changes: 7 additions & 1 deletion Resources/Private/Fusion/Backend/Form/Vocabulary.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ prototype(Sitegeist.Taxonomy:Form.Vocabulary) < prototype(Neos.Fusion:Component)
<label class="neos-control-label" for="name">
{props.i18nVocabulary.id('properties.name')}
</label>
<Neos.Fusion.Form:Input attributes.class="neos-span6" field.name="name" attributes.required attributes.pattern="[a-z0-9]+" />
<Neos.Fusion.Form:Input
attributes.class="neos-span6"
field.name="name"
attributes.required attributes.pattern="[a-z0-9]+"
attributes.readonly="1" attributes.readonly.@if={props.vocabularyNode.classification.value == 'tethered'}

/>
</div>

<div class="neos-control-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List.Item) < prototype(Neos.F
<i class="fas fa-pencil-alt"></i>
</Neos.Fusion:Link.Action>

<Neos.Fusion:Fragment @if={!props.taxonomySubtree.autoCreated}>
<Neos.Fusion:Fragment @if={props.taxonomySubtree.node.classification.value != 'tethered'}>
&nbsp;
<button class="neos-button neos-button-danger"
title={props.i8n.id('generic.delete')}
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Fusion/Backend/Views/Vocabulary.List.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi
<i class="fas fa-pencil-alt"></i>
</Neos.Fusion:Link.Action>

<Neos.Fusion:Fragment @if={!vocabulary.node.autoCreated} >
<Neos.Fusion:Fragment @if={vocabulary.classification.value != 'tethered'} >
&nbsp;
<button class="neos-button neos-button-danger" title={props.i18n.id('generic.delete')} data-toggle="modal" href={'#deleteVocabulary_' + vocabulary.nodeAggregateId.value} data-neos-toggle="tooltip">
<i class="fas fa-trash-alt icon-white"></i>
Expand All @@ -68,7 +68,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Vocabulary.List) < prototype(Neos.Fusi

</div>

<Neos.Fusion:Fragment @if={!vocabulary.node.autoCreated} >
<Neos.Fusion:Fragment @if={vocabulary.classification.value != 'tethered'} >
<div class="neos-hide" id={'deleteVocabulary_' + vocabulary.nodeAggregateId.value}>
<div class="neos-modal-centered">
<div class="neos-modal-content">
Expand Down
Loading