Browse Source

Review notes

pull/13082/head
Halil İbrahim Kalkan 4 years ago
parent
commit
14966dfc5d
  1. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/appsettings.json
  2. 3
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs
  3. 4
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentWidgetConfig.cs
  4. 12
      modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/Helper.cs
  5. 48
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(localdb)\\.\\MSSQLLocalDB;Database=CmsKit_Unified;Trusted_Connection=True" "Default": "Server=(localdb)\\MSSQLLocalDB;Database=CmsKit_Unified;Trusted_Connection=True"
} }
} }

3
modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentParser.cs

@ -24,7 +24,7 @@ public class ContentParser : ITransientDependency
{ {
return Task.FromResult(new List<ContentFragment> return Task.FromResult(new List<ContentFragment>
{ {
new ContentFragment() { Type = Markdown }.SetProperty(Content, content), new ContentFragment { Type = Markdown }.SetProperty(Content, content),
}); });
} }
@ -117,5 +117,4 @@ public class ContentParser : ITransientDependency
} }
} }
} }
} }

4
modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/ContentWidgetConfig.cs

@ -5,9 +5,9 @@ namespace Volo.CmsKit.Contents;
public class ContentWidgetConfig public class ContentWidgetConfig
{ {
public string Name { get; } public string Name { get; }
public Type ViewComponentType { get; set; } public Type ViewComponentType { get; set; } //TODO: Remove this
public ContentWidgetConfig(string name) public ContentWidgetConfig(string name) //TODO: widgetName
{ {
Name = name; Name = name;
} }

12
modules/cms-kit/src/Volo.CmsKit.Common.Web/Contents/Helper.cs

@ -3,21 +3,19 @@ using System.Dynamic;
namespace Volo.CmsKit.Web.Contents; namespace Volo.CmsKit.Web.Contents;
public static class Helper public static class DictionaryDynamicExtensions
{ {
public static dynamic ConvertToDynamicObject(this Dictionary<string, object> dict) public static dynamic ConvertToDynamicObject(this Dictionary<string, object> dict) //TODO: Move to AbpDictionaryExtensions
{ {
var eo = new ExpandoObject(); var expandoObject = new ExpandoObject();
var eoColl = (ICollection<KeyValuePair<string, object>>)eo; var eoColl = (ICollection<KeyValuePair<string, object>>)expandoObject;
foreach (var kvp in dict) foreach (var kvp in dict)
{ {
eoColl.Add(kvp); eoColl.Add(kvp);
} }
dynamic eoDynamic = eo; return expandoObject;
return eoDynamic;
} }
} }

48
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Blogs/BlogPost.cshtml

@ -71,34 +71,34 @@
<small style="opacity:.65;">@Model.BlogPost.CreationTime</small> <small style="opacity:.65;">@Model.BlogPost.CreationTime</small>
</p> </p>
@foreach (var contentFragment in Model.BlogPost.ContentFragments) @foreach (var contentFragment in Model.BlogPost.ContentFragments)
{
if (contentFragment.Type == ContentConsts.Markdown)
{
@Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty<string>("Content")))
}
else if (contentFragment.Type == ContentConsts.Widget)
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
}
<p class="mb-3">
@if (Model.BlogPost.LastModificationTime != null)
{ {
<small style="opacity:.65;">@L["LastModification"].Value : @Model.BlogPost.LastModificationTime</small> if (contentFragment.Type == ContentConsts.Markdown)
{
@Html.Raw(await MarkdownRenderer.RenderAsync(contentFragment.GetProperty<string>("Content")))
}
else if (contentFragment.Type == ContentConsts.Widget)
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
} }
</p> <p class="mb-3">
<hr /> @if (Model.BlogPost.LastModificationTime != null)
{
<small style="opacity:.65;">@L["LastModification"].Value : @Model.BlogPost.LastModificationTime</small>
}
</p>
<hr />
@if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>()) @if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>())
{
if (Model.TagsFeature?.IsEnabled == true)
{ {
@await Component.InvokeAsync(typeof(TagViewComponent), new if (Model.TagsFeature?.IsEnabled == true)
{ {
entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, @await Component.InvokeAsync(typeof(TagViewComponent), new
entityId = Model.BlogPost.Id.ToString(), {
urlFormat = $"/blogs/{Model.BlogSlug}?tagId={{TagId}}" entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType,
}) entityId = Model.BlogPost.Id.ToString(),
urlFormat = $"/blogs/{Model.BlogSlug}?tagId={{TagId}}"
})
} }
} }
</div> </div>

Loading…
Cancel
Save