Skip to content

Commit

Permalink
Set listpart property in listpartviewmodel (OrchardCMS#15560)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliamiras authored and MichaelPetrinolis committed Mar 30, 2024
1 parent 517a9e8 commit 81158a9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private ShapeResult InitializeDisplayListPartDisplayShape(ListPart listPart, Bui
model.ContainedContentTypeDefinitions = await GetContainedContentTypesAsync(settings);
model.Context = context;
model.Pager = await context.New.PagerSlim(pager);
model.ListPart = listPart;
})
.Location("Detail", "Content:10");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public async ValueTask<FluidValue> ProcessAsync(FluidValue input, FilterArgument
{
sb.Append(OrchardRazorHelperExtensions.ConvertContentItem(contentItem).ToString());
}
else if (content is ContentPart contentPart)
{
sb.Append(OrchardRazorHelperExtensions.ConvertContentPart(contentPart).ToString());
}
else if (content is IShape shape)
{
sb.Append(shape.ShapeToJson().ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,16 @@ internal static JObject ConvertContentItem(ContentItem contentItem)

return o;
}

internal static JsonObject ConvertContentPart(ContentPart contentPart)
{
var o = new JsonObject
{
// Write all well-known properties.
[nameof(ContentPart.ContentItem)] = ConvertContentItem(contentPart.ContentItem),
[nameof(ContentPart.Content)] = JObject.FromObject(contentPart.Content),
};

return o;
}
}

0 comments on commit 81158a9

Please sign in to comment.