mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 07:26:43 +08:00
flag exclude children for taxonomies (#8481)
This commit is contained in:
parent
230dfc30da
commit
f23d9292c5
@ -47,8 +47,11 @@ namespace Orchard.Taxonomies.Projections {
|
|||||||
var terms = ids.Select(_taxonomyService.GetTerm).ToList();
|
var terms = ids.Select(_taxonomyService.GetTerm).ToList();
|
||||||
var allChildren = new List<TermPart>();
|
var allChildren = new List<TermPart>();
|
||||||
foreach (var term in terms) {
|
foreach (var term in terms) {
|
||||||
allChildren.AddRange(_taxonomyService.GetChildren(term));
|
bool.TryParse(context.State.ExcludeChildren?.Value, out bool excludeChildren);
|
||||||
allChildren.Add(term);
|
if (!excludeChildren)
|
||||||
|
allChildren.AddRange(_taxonomyService.GetChildren(term));
|
||||||
|
if (term != null)
|
||||||
|
allChildren.Add(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
allChildren = allChildren.Distinct().ToList();
|
allChildren = allChildren.Distinct().ToList();
|
||||||
|
@ -48,8 +48,13 @@ namespace Orchard.Taxonomies.Projections {
|
|||||||
Id: "operator-is-all-of", Name: "Operator",
|
Id: "operator-is-all-of", Name: "Operator",
|
||||||
Title: T("Is all of"), Value: "1"
|
Title: T("Is all of"), Value: "1"
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
);
|
_ExcludeChildren: Shape.Checkbox(
|
||||||
|
Id: "ExcludeChildren", Name: "ExcludeChildren",
|
||||||
|
Title: T("Automatically exclude children terms in filtering"),
|
||||||
|
Value: "true"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach (var taxonomy in _taxonomyService.GetTaxonomies()) {
|
foreach (var taxonomy in _taxonomyService.GetTaxonomies()) {
|
||||||
f._Terms.Add(new SelectListItem { Value = String.Empty, Text = taxonomy.Name });
|
f._Terms.Add(new SelectListItem { Value = String.Empty, Text = taxonomy.Name });
|
||||||
|
Loading…
Reference in New Issue
Block a user