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

Fixes Stereotype Filter Binding and Thumbnail #13933

Merged
merged 2 commits into from
Jul 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public override IDisplayResult Display(ContentOptionsViewModel model)
Initialize<ContentOptionsViewModel>("ContentsAdminListBulkActions", m => BuildContentOptionsViewModel(m, model)).Location("BulkActions", "Content:10"),
View("ContentsAdminFilters_Thumbnail__DisplayText", model).Location("Thumbnail", "Content:10"),
View("ContentsAdminFilters_Thumbnail__ContentType", model).Location("Thumbnail", "Content:20"),
View("ContentsAdminFilters_Thumbnail__Status", model).Location("Thumbnail", "Content:30"),
View("ContentsAdminFilters_Thumbnail__Sort", model).Location("Thumbnail", "Content:40")
View("ContentsAdminFilters_Thumbnail__Stereotype", model).Location("Thumbnail", "Content:30"),
View("ContentsAdminFilters_Thumbnail__Status", model).Location("Thumbnail", "Content:40"),
View("ContentsAdminFilters_Thumbnail__Sort", model).Location("Thumbnail", "Content:50")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public void Build(QueryEngineBuilder<ContentItem> builder)

return query.With<ContentItemIndex>(x => x.ContentType == contentType && x.Owner == userNameIdentifier);
}

// At this point, the given contentType is invalid. Ignore it.
}

Expand Down Expand Up @@ -211,9 +212,9 @@ public void Build(QueryEngineBuilder<ContentItem> builder)
if (!String.IsNullOrEmpty(stereotype))
{
var contentTypeDefinitionNames = contentDefinitionManager.ListTypeDefinitions()
.Where(definition => definition.StereotypeEquals(stereotype, StringComparison.OrdinalIgnoreCase))
.Select(definition => definition.Name)
.ToList();
.Where(definition => definition.StereotypeEquals(stereotype, StringComparison.OrdinalIgnoreCase))
.Select(definition => definition.Name)
.ToList();

// We display a specific type even if it's not listable so that admin pages
// can reuse the content list page for specific types.
Expand Down Expand Up @@ -247,22 +248,6 @@ public void Build(QueryEngineBuilder<ContentItem> builder)

return query;
})
.MapTo<ContentOptionsViewModel>((val, model) =>
{
if (!String.IsNullOrEmpty(val))
{
model.SelectedContentType = val;
}
})
.MapFrom<ContentOptionsViewModel>((model) =>
{
if (!String.IsNullOrEmpty(model.SelectedContentType))
{
return (true, model.SelectedContentType);
}

return (false, String.Empty);
})
)
.WithDefaultTerm(ContentsAdminListFilterOptions.DefaultTermName, builder => builder
.ManyCondition(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@model ShapeViewModel<ContentOptionsViewModel>
@{
var term = Model.Value.FilterResult.FirstOrDefault(x => x.TermName == "stereotype");
}

<h4 class="card-title">Content Type Stereotype</h4>
<pre class="mb-3">@(term?.ToString() ?? "stereotype:...")</pre>
<p>@T["Filters on a specified content type stereotype."]</p>
<div class="d-block text-end">
<span>
<i class="fa-solid fa-sm fa-minus text-primary" aria-hidden="true"></i>
</span>
</div>