mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 14:54:57 +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 allChildren = new List<TermPart>();
|
||||
foreach (var term in terms) {
|
||||
allChildren.AddRange(_taxonomyService.GetChildren(term));
|
||||
allChildren.Add(term);
|
||||
bool.TryParse(context.State.ExcludeChildren?.Value, out bool excludeChildren);
|
||||
if (!excludeChildren)
|
||||
allChildren.AddRange(_taxonomyService.GetChildren(term));
|
||||
if (term != null)
|
||||
allChildren.Add(term);
|
||||
}
|
||||
|
||||
allChildren = allChildren.Distinct().ToList();
|
||||
|
@ -48,8 +48,13 @@ namespace Orchard.Taxonomies.Projections {
|
||||
Id: "operator-is-all-of", Name: "Operator",
|
||||
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()) {
|
||||
f._Terms.Add(new SelectListItem { Value = String.Empty, Text = taxonomy.Name });
|
||||
|
Loading…
Reference in New Issue
Block a user