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",
"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."
}

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

Loading…
Cancel
Save