mirror of https://github.com/abpframework/abp
parent
31224b98d8
commit
0cdc2cf4b0
@ -1,44 +0,0 @@
|
||||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
|
||||
|
||||
@using System.Dynamic
|
||||
@using Volo.CmsKit.Public.Web.Renderers
|
||||
@using Volo.Abp.Data
|
||||
@using Volo.CmsKit.Contents
|
||||
|
||||
@inject IMarkdownToHtmlRenderer MarkdownRenderer
|
||||
|
||||
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Pages.PageViewModel
|
||||
|
||||
<abp-card>
|
||||
<abp-card-body>
|
||||
@foreach (ContentFragment contentFragment in Model.ContentFragments)
|
||||
{
|
||||
if (contentFragment.Type == "Markdown") //TODO: Constant
|
||||
{
|
||||
@Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty<string>("Content")))
|
||||
}
|
||||
else if (contentFragment.Type == "Widget") //TODO: Constant
|
||||
{
|
||||
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), ConvertToDynamicObject(contentFragment.ExtraProperties))
|
||||
}
|
||||
}
|
||||
</abp-card-body>
|
||||
</abp-card>
|
||||
|
||||
|
||||
@{
|
||||
dynamic ConvertToDynamicObject(Dictionary<string, object> dict)
|
||||
{
|
||||
var eo = new ExpandoObject();
|
||||
var eoColl = (ICollection<KeyValuePair<string, object>>)eo;
|
||||
|
||||
foreach (var kvp in dict)
|
||||
{
|
||||
eoColl.Add(kvp);
|
||||
}
|
||||
|
||||
dynamic eoDynamic = eo;
|
||||
|
||||
return eoDynamic;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue