Browse Source

cmskit comment login buttons

pull/4961/head
Yunus Emre Kalkan 6 years ago
parent
commit
9ad272db71
  1. 2
      modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json
  2. 5
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs
  3. 17
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml

2
modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json

@ -9,6 +9,8 @@
"Reply": "Reply", "Reply": "Reply",
"Update": "Update", "Update": "Update",
"Edit": "Edit", "Edit": "Edit",
"LoginToAddComment": "Login to add comment",
"LoginToReply": "Login to reply",
"MessageDeletionConfirmationMessage": "This comment will be deleted completely.", "MessageDeletionConfirmationMessage": "This comment will be deleted completely.",
"CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display." "CommentAuthorizationExceptionMessage": "Those comments are not allowed for public display."
} }

5
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; CommentPublicAppService = commentPublicAppService;
} }
public virtual async Task<IViewComponentResult> InvokeAsync( string entityType,string entityId) public virtual async Task<IViewComponentResult> InvokeAsync(string entityType, string entityId, string loginUrl = null)
{ {
var result = await CommentPublicAppService.GetAllForEntityAsync(entityType, entityId); var result = await CommentPublicAppService.GetAllForEntityAsync(entityType, entityId);
@ -32,6 +32,7 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Commenting
{ {
EntityId = entityId, EntityId = entityId,
EntityType = entityType, EntityType = entityType,
LoginUrl = loginUrl,
Comments = result.Items.ToList() Comments = result.Items.ToList()
}; };
@ -44,6 +45,8 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Commenting
public string EntityId { get; set; } public string EntityId { get; set; }
public string LoginUrl { get; set; }
public List<CommentWithDetailsDto> Comments { get; set; } public List<CommentWithDetailsDto> Comments { get; set; }
} }
} }

17
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml

@ -44,9 +44,16 @@
@if (!isReply) @if (!isReply)
{ {
<a href="#" class="comment-reply-link" data-reply-id="@id.ToString()"> @if (CurrentUser.IsAuthenticated)
<i class="fa fa-reply"></i> @L["Reply"] {
</a> <a href="#" class="comment-reply-link" data-reply-id="@id.ToString()">
<i class="fa fa-reply"></i> @L["Reply"]
</a>
}
else
{
<a href="@Model.LoginUrl"> @L["LoginToReply"]</a>
}
} }
@if (authorId == CurrentUser.Id) @if (authorId == CurrentUser.Id)
{ {
@ -120,5 +127,9 @@
{ {
@GetCommentArea(null).Invoke(null) @GetCommentArea(null).Invoke(null)
} }
else if (!string.IsNullOrWhiteSpace(Model.LoginUrl))
{
<a href="@Model.LoginUrl" class="btn btn-primary"> @L["LoginToAddComment"]</a>
}
</div> </div>
</div> </div>

Loading…
Cancel
Save