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 036ebd7de1..6d577e080c 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 @@ -9,6 +9,8 @@ "Reply": "Reply", "Update": "Update", "Edit": "Edit", + "LoginToAddComment": "Login to add comment", + "LoginToReply": "Login to reply", "MessageDeletionConfirmationMessage": "This comment will be deleted completely.", "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display." } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs index 9f97619d57..50f07ab9b1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs @@ -24,7 +24,7 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Commenting CommentPublicAppService = commentPublicAppService; } - public virtual async Task InvokeAsync( string entityType,string entityId) + public virtual async Task InvokeAsync(string entityType, string entityId, string loginUrl = null) { var result = await CommentPublicAppService.GetAllForEntityAsync(entityType, entityId); @@ -32,6 +32,7 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Commenting { EntityId = entityId, EntityType = entityType, + LoginUrl = loginUrl, Comments = result.Items.ToList() }; @@ -44,6 +45,8 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Commenting public string EntityId { get; set; } + public string LoginUrl { get; set; } + public List Comments { get; set; } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml index e24e99fbaa..f61ff27e95 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml @@ -44,9 +44,16 @@ @if (!isReply) { - - @L["Reply"] - + @if (CurrentUser.IsAuthenticated) + { + + @L["Reply"] + + } + else + { + @L["LoginToReply"] + } } @if (authorId == CurrentUser.Id) { @@ -120,5 +127,9 @@ { @GetCommentArea(null).Invoke(null) } + else if (!string.IsNullOrWhiteSpace(Model.LoginUrl)) + { + @L["LoginToAddComment"] + }