diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs index 607effcebd..28ca2d9141 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Blogs/BlogPostConsts.cs @@ -9,5 +9,7 @@ public static int MinUrlSlugLength { get; set; } = 2; public static int MaxShortDescriptionLength { get; set; } = 256; + + public const string EntityType = "BlogPost"; } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 00eccab1be..f59a5c981b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -3,10 +3,13 @@ "texts": { "CmsKit:0002": "Content already exists!", "CmsKit:0003": "The entity {0} is not taggable.", + "CmsKit:Page:0001": "The given url ({0}) already exists.", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display.", "Comments": "Comments", "Delete": "Delete", "Edit": "Edit", + "Read": "Read", + "LastModification": "Last Modification", "LoginToAddComment": "Login to add comment", "LoginToRate": "Login to rate", "LoginToReply": "Login to reply", @@ -17,14 +20,14 @@ "Permission:Contents.Create": "Create Content", "Permission:Contents.Delete": "Delete Content", "Permission:Contents.Update": "Update Content", - "Permission:TagManagement": "Tag Management", - "Permission:TagManagement.Create": "Create", - "Permission:TagManagement.Delete": "Delete", - "Permission:TagManagement.Update": "Update", "Permission:PageManagement": "Page Management", "Permission:PageManagement:Create": "Create", "Permission:PageManagement:Delete": "Delete", "Permission:PageManagement:Update": "Update", + "Permission:TagManagement": "Tag Management", + "Permission:TagManagement.Create": "Create", + "Permission:TagManagement.Delete": "Delete", + "Permission:TagManagement.Update": "Update", "PickYourReaction": "Pick your reaction", "RatingUndoMessage": "Your rating will be undo.", "Reply": "Reply", @@ -35,7 +38,6 @@ "Undo": "Undo", "Update": "Update", "YourComment": "Your comment", - "YourReply": "Your reply", - "CmsKit:Page:0001": "The given url ({0}) already exists." + "YourReply": "Your reply" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 1ebb0c126b..77fe348ad6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -3,10 +3,13 @@ "texts": { "CmsKit:0002": "İçerik zaten mevcut!", "CmsKit:0003": "{0} ögesi etiketlenebilir değil.", + "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır.", "CommentAuthorizationExceptionMessage": "Bu yorumları görebilmek için yetki gerekir.", "Comments": "Yorumlar", "Delete": "Sil", "Edit": "Düzenle", + "Read": "Oku", + "LastModification": "Son Güncellenme", "LoginToAddComment": "Yorum yapmak için giriş yap", "LoginToRate": "Oylamak için giriş yapın", "LoginToReply": "Cevap vermek için giriş yap", @@ -31,7 +34,6 @@ "Undo": "Geri al", "Update": "Güncelle", "YourComment": "Yorumunuz", - "YourReply": "Cevabınız", - "CmsKit:Page:0001": "Girilen url ({0}) kullanımdadır." + "YourReply": "Cevabınız" } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs index fdb721d8d8..c3cf64b44c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Blogs/IBlogPostRepository.cs @@ -15,5 +15,7 @@ namespace Volo.CmsKit.Blogs Task GetByUrlSlugAsync(Guid blogId, string urlSlug, CancellationToken cancellationToken = default); Task> GetPagedListAsync(Guid blogId, int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default); + + Task GetCountAsync(Guid blogId, CancellationToken cancellationToken = default); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index 1a6546d5fc..df2893dd1e 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -10,6 +10,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.CmsKit.EntityFrameworkCore; using System.Linq; using System.Data.Common; +using Volo.Abp.Domain.Entities; namespace Volo.CmsKit.Blogs { @@ -19,14 +20,27 @@ namespace Volo.CmsKit.Blogs { } - public Task GetByUrlSlugAsync(Guid blogId, string urlSlug, CancellationToken cancellationToken = default) + public async Task GetByUrlSlugAsync(Guid blogId, string urlSlug, CancellationToken cancellationToken = default) { - return GetAsync(x => x.BlogId == blogId && x.UrlSlug.ToLower() == urlSlug, cancellationToken: cancellationToken); + var dbSet = await GetDbSetAsync(); + + return await dbSet + .Include(i=> i.Creator) + .Where(x => + x.BlogId == blogId && x.UrlSlug.ToLower() == urlSlug) + .FirstOrDefaultAsync(cancellationToken: cancellationToken) + ?? throw new EntityNotFoundException(typeof(BlogPost)); } - public async Task> GetPagedListAsync(Guid blogId, int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default) + public async Task GetCountAsync(Guid blogId, CancellationToken cancellationToken = default) { + return await (await GetQueryableAsync()).CountAsync( + x => x.BlogId == blogId, + cancellationToken); + } + public async Task> GetPagedListAsync(Guid blogId, int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default) + { var queryable = (await GetQueryableAsync()) .Include(i => i.Creator) .Where(x => x.BlogId == blogId); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index 638c219bb6..bcd6e33211 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -1,4 +1,6 @@ -using System; +using MongoDB.Driver; +using Nito.AsyncEx; +using System; using System.Collections.Generic; using System.Linq; using System.Linq.Dynamic.Core; @@ -7,6 +9,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.MongoDB; using Volo.CmsKit.Blogs; +using Volo.CmsKit.Users; namespace Volo.CmsKit.MongoDB.Blogs { @@ -18,18 +21,28 @@ namespace Volo.CmsKit.MongoDB.Blogs public Task GetByUrlSlugAsync(Guid blogId, string urlSlug, CancellationToken cancellationToken = default) { - return GetAsync(x => x.BlogId == blogId && x.UrlSlug.ToLower() == urlSlug, cancellationToken: cancellationToken); + return GetAsync(x => + x.BlogId == blogId && + x.UrlSlug.ToLower() == urlSlug, + includeDetails: true, + cancellationToken: cancellationToken); + } + + public async Task GetCountAsync(Guid blogId, CancellationToken cancellationToken = default) + { + return await AsyncExecuter.CountAsync( + await WithDetailsAsync(), + x => x.BlogId == blogId, + cancellationToken); } public async Task> GetPagedListAsync(Guid blogId, int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default) { var dbContext = await GetDbContextAsync(cancellationToken); - var blogPostQueryable = await GetQueryableAsync(); + var blogPostQueryable = await WithDetailsAsync(); var queryable = blogPostQueryable - .Where(x => x.BlogId == blogId) - //.Join(dbContext.CmsUsers, outerKeySelector: x => x.CreatorId, innerKeySelector: x => x.Id, resultSelector: s => s) - ; + .Where(x => x.BlogId == blogId); if (!sorting.IsNullOrWhiteSpace()) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs index de460f0764..6771ae6adf 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Blogs/IBlogPostPublicAppService.cs @@ -6,7 +6,7 @@ namespace Volo.CmsKit.Public.Blogs { public interface IBlogPostPublicAppService { - Task> GetListAsync(string blogUrlSlug, PagedAndSortedResultRequestDto input); + Task> GetListAsync(string blogUrlSlug, PagedAndSortedResultRequestDto input); Task GetAsync(string blogUrlSlug, string blogPostUrlSlug); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 907e7e7518..d9bb9ab281 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -29,13 +29,15 @@ namespace Volo.CmsKit.Public.Blogs return ObjectMapper.Map(blogPost); } - public async Task> GetListAsync(string blogUrlSlug, PagedAndSortedResultRequestDto input) + public async Task> GetListAsync(string blogUrlSlug, PagedAndSortedResultRequestDto input) { var blog = await BlogRepository.GetByUrlSlugAsync(blogUrlSlug); var blogPosts = await BlogPostRepository.GetPagedListAsync(blog.Id, input.SkipCount, input.MaxResultCount, input.Sorting); - return ObjectMapper.Map, List>(blogPosts); + return new PagedResultDto( + await BlogPostRepository.GetCountAsync(blog.Id), + ObjectMapper.Map, List>(blogPosts)); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs index 953102aa79..d49ef63a85 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/CmsKitPublicWebModule.cs @@ -61,10 +61,10 @@ namespace Volo.CmsKit.Public.Web { Configure(options => { - if (GlobalFeatureManager.Instance.IsEnabled()) - { - options.Conventions.AddPageRoute("/CmsKit/Pages/Index", @"{*pageUrl:minlength(1)}"); - } + //if (GlobalFeatureManager.Instance.IsEnabled()) + //{ + // options.Conventions.AddPageRoute("/CmsKit/Pages/Index", @"{*pageUrl:minlength(1)}"); + //} }); } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml new file mode 100644 index 0000000000..cf047d525c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml @@ -0,0 +1,53 @@ +@page "/b/{blogUrlSlug}/{blogPostUrlSlug}" + +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPost +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPostComment +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs +@using Volo.CmsKit.Public.Web.Pages +@using Volo.Abp.GlobalFeatures +@using Volo.CmsKit.GlobalFeatures +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelection +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating + +@inherits CmsKitPublicPageBase + +@model BlogPostModel + +@{ + PageLayout.Content.Title = Model.BlogPost.Title; +} + +@await Component.InvokeAsync(typeof(DefaultBlogPostViewComponent), new +{ + Model.BlogUrlSlug, + Model.BlogPostUrlSlug +}) + +@if (GlobalFeatureManager.Instance.IsEnabled()) +{ + @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) +} + +@if (GlobalFeatureManager.Instance.IsEnabled()) +{ + @await Component.InvokeAsync(typeof(RatingViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) +} + +
+ +@if (GlobalFeatureManager.Instance.IsEnabled()) +{ + @await Component.InvokeAsync(typeof(DefaultBlogPostCommentViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.BlogPost.Id.ToString() + }) +} \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs new file mode 100644 index 0000000000..4a63ec1692 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/BlogPost.cshtml.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.CmsKit.Public.Blogs; + +namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs +{ + public class BlogPostModel : CmsKitPublicPageModelBase + { + [BindProperty(SupportsGet = true)] + public string BlogUrlSlug { get; set; } + + [BindProperty(SupportsGet = true)] + public string BlogPostUrlSlug { get; set; } + + public BlogPostPublicDto BlogPost { get; private set; } + + protected IBlogPostPublicAppService BlogPostPublicAppService { get; } + + public BlogPostModel(IBlogPostPublicAppService blogPostPublicAppService) + { + BlogPostPublicAppService = blogPostPublicAppService; + } + + public async Task OnGetAsync() + { + BlogPost = await BlogPostPublicAppService.GetAsync(BlogUrlSlug, BlogPostUrlSlug); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml new file mode 100644 index 0000000000..06a20650c7 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml @@ -0,0 +1,46 @@ +@page "/b/{blogUrlSlug}" + +@using Volo.CmsKit.Public.Web.Pages + +@inherits CmsKitPublicPageBase + +@model Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs.IndexModel + + + @foreach (var blog in Model.Blogs.Items) + { + + + + + @blog.Title + + + @@@blog.Creator?.UserName + + + + + @blog.ShortDescription + + + + + + + + + + @blog.CreationTime + + + + + + } + + + + + diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs new file mode 100644 index 0000000000..d375efef61 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Blogs/Index.cshtml.cs @@ -0,0 +1,45 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination; +using Volo.CmsKit.Public.Blogs; + +namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Blogs +{ + public class IndexModel : CmsKitPublicPageModelBase + { + public const int PageSize = 12; + + [BindProperty(SupportsGet = true)] + public string BlogUrlSlug { get; set; } + + [BindProperty(SupportsGet = true)] + public int CurrentPage { get; set; } = 1; + + public PagedResultDto Blogs { get; private set; } + + public PagerModel PagerModel => new PagerModel(Blogs.TotalCount, Blogs.Items.Count, CurrentPage, PageSize, Request.Path.ToString()); + + protected IBlogPostPublicAppService BlogPostPublicAppService { get; } + + public IndexModel(IBlogPostPublicAppService blogPostPublicAppService) + { + BlogPostPublicAppService = blogPostPublicAppService; + } + + public async Task OnGetAsync() + { + Blogs = await BlogPostPublicAppService.GetListAsync( + BlogUrlSlug, + new PagedAndSortedResultRequestDto + { + SkipCount = PageSize * (CurrentPage - 1), + MaxResultCount = PageSize + }); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml new file mode 100644 index 0000000000..df409d6dde --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml @@ -0,0 +1,31 @@ +@model Volo.CmsKit.Public.Blogs.BlogPostPublicDto +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Contents +@using Volo.Abp.AspNetCore.Mvc.UI.Layout +@using Volo.CmsKit.Localization +@using Microsoft.Extensions.Localization + +@inject IStringLocalizer L + + + + + @Model.Title + @@@Model.Creator?.UserName + + + @await Component.InvokeAsync(typeof(ContentViewComponent), new + { + entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType, + entityId = Model.Id.ToString() + }) + + + @Model.CreationTime + @if (Model.LastModificationTime != null) + { + @L["LastModification"].Value : @Model.LastModificationTime + } + + + + diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/DefaultBlogPostViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/DefaultBlogPostViewComponent.cs new file mode 100644 index 0000000000..4a055d6679 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPost/DefaultBlogPostViewComponent.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.CmsKit.Public.Blogs; + +namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPost +{ + [ViewComponent(Name = "CmsDefaultBlogPost")] + public class DefaultBlogPostViewComponent : AbpViewComponent + { + protected IBlogPostPublicAppService BlogPostPublicAppService { get; } + + public DefaultBlogPostViewComponent(IBlogPostPublicAppService blogPostPublicAppService) + { + BlogPostPublicAppService = blogPostPublicAppService; + } + + public virtual async Task InvokeAsync(string blogUrlSlug, string blogPostUrlSlug) + { + var blogPost = await BlogPostPublicAppService.GetAsync(blogUrlSlug, blogPostUrlSlug); + + return View("~/Pages/CmsKit/Shared/Components/Blogs/BlogPost/Default.cshtml", blogPost); + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/Default.cshtml new file mode 100644 index 0000000000..c34f64eb0c --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/Default.cshtml @@ -0,0 +1,22 @@ +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting +@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPostComment +@using Volo.CmsKit.Localization +@using Microsoft.Extensions.Localization + +@inject IStringLocalizer L + +@model DefaultBlogPostCommentViewComponent.DefaultBlogPostCommentViewModel + + + + + @L["Comments"] + + + @await Component.InvokeAsync(typeof(CommentingViewComponent), new + { + entityType = Model.EntityType, + entityId = Model.EntityId + }) + + \ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/DefaultBlogPostCommentViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/DefaultBlogPostCommentViewComponent.cs new file mode 100644 index 0000000000..c551146f5f --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/DefaultBlogPostCommentViewComponent.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.CmsKit.Public.Blogs; + +namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPostComment +{ + [ViewComponent(Name = "CmsDefaultBlogPostComment")] + public class DefaultBlogPostCommentViewComponent : AbpViewComponent + { + protected IBlogPostPublicAppService BlogPostPublicAppService; + + public DefaultBlogPostCommentViewComponent(IBlogPostPublicAppService blogPostPublicAppService) + { + BlogPostPublicAppService = blogPostPublicAppService; + } + + public virtual async Task InvokeAsync(string entityType, string entityId) + { + return View( + "~/Pages/CmsKit/Shared/Components/Blogs/BlogPostComment/Default.cshtml", + new DefaultBlogPostCommentViewModel + { + EntityType = entityType, + EntityId = entityId + }); + } + + public class DefaultBlogPostCommentViewModel + { + public string EntityType { get; set; } + public string EntityId { get; set; } + } + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKitPublicPageBase.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKitPublicPageBase.cs new file mode 100644 index 0000000000..879745bf24 --- /dev/null +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKitPublicPageBase.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using Microsoft.Extensions.Localization; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.Layout; +using Volo.CmsKit.Localization; + +namespace Volo.CmsKit.Public.Web.Pages +{ + public class CmsKitPublicPageBase : Microsoft.AspNetCore.Mvc.RazorPages.Page + { + [RazorInject] + public IStringLocalizer L { get; set; } + + [RazorInject] + public IPageLayout PageLayout { get; set; } + + public override Task ExecuteAsync() + { + return Task.CompletedTask; // Will be overriden by razor pages. (.cshtml) + } + } +}