|
|
|
@ -64,34 +64,37 @@ |
|
|
|
</div>; |
|
|
|
} |
|
|
|
@{ |
|
|
|
Func<dynamic, IHtmlContent> GetCommentActionArea(Guid id, Guid authorId, bool isReply, string text) => |
|
|
|
@<div> |
|
|
|
<div class="text-right"> |
|
|
|
@if (!isReply) |
|
|
|
Func<dynamic, IHtmlContent> GetCommentActionArea(Guid id, Guid authorId, bool isReply) => |
|
|
|
@<div class="text-right"> |
|
|
|
@if (!isReply) |
|
|
|
{ |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
<a href="#" class="comment-reply-link btn btn-sm btn-primary" data-reply-id="@id.ToString()" id="@($"cms-comment_{Model.EntityType}_{Model.EntityId}_{id}_link")"> |
|
|
|
<i class="fa fa-reply mr-1"></i> @L["Reply"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
<a href="@(Model.LoginUrl + "_" + id)" class="btn btn-sm btn-primary shadow-sm"> @L["LoginToReply"]</a> |
|
|
|
} |
|
|
|
<a href="#" class="comment-reply-link btn btn-sm btn-primary" data-reply-id="@id.ToString()" id="@($"cms-comment_{Model.EntityType}_{Model.EntityId}_{id}_link")"> |
|
|
|
<i class="fa fa-reply mr-1"></i> @L["Reply"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
@if (authorId == CurrentUser.Id) |
|
|
|
else |
|
|
|
{ |
|
|
|
<a href="#" class="comment-delete-link btn btn-sm shadow-sm bg-white" data-id="@id.ToString()"> |
|
|
|
<i class="fa fa-trash mr-1 text-danger"></i> @L["Delete"] |
|
|
|
</a> |
|
|
|
<a href="@(Model.LoginUrl + "_" + id)" class="btn btn-sm btn-primary shadow-sm"> @L["LoginToReply"]</a> |
|
|
|
} |
|
|
|
} |
|
|
|
@if (authorId == CurrentUser.Id) |
|
|
|
{ |
|
|
|
<a href="#" class="comment-delete-link btn btn-sm shadow-sm bg-white" data-id="@id.ToString()"> |
|
|
|
<i class="fa fa-trash mr-1 text-danger"></i> @L["Delete"] |
|
|
|
</a> |
|
|
|
|
|
|
|
|
|
|
|
<a href="#" class="comment-edit-link btn btn-sm shadow-sm bg-white" data-id="@id.ToString()"> |
|
|
|
<i class="fa fa-pencil mr-1 text-info"></i> @L["Edit"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
</div> |
|
|
|
<a href="#" class="comment-edit-link btn btn-sm shadow-sm bg-white" data-id="@id.ToString()"> |
|
|
|
<i class="fa fa-pencil mr-1 text-info"></i> @L["Edit"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
</div>; |
|
|
|
} |
|
|
|
@{ |
|
|
|
Func<dynamic, IHtmlContent> GetEditArea(Guid id, string text) => |
|
|
|
@<div> |
|
|
|
<div class="cms-comment-edit-area" id="@($"cms-comment_{Model.EntityType}_{Model.EntityId}_{id}")" data-id="@id.ToString()" style="display:none"> |
|
|
|
|
|
|
|
<div class="card bg-light p-4 mx-0 mt-3"> |
|
|
|
@ -115,7 +118,20 @@ |
|
|
|
<h5 class="mb-0 mt-4"> |
|
|
|
<i class="fas fa-comment-alt"></i> @L["Comments"] |
|
|
|
</h5> |
|
|
|
|
|
|
|
<div> |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
<div id="@($"cms-comment_{Model.EntityType}_{Model.EntityId}")"> |
|
|
|
@GetCommentArea(null).Invoke(null) |
|
|
|
</div> |
|
|
|
} |
|
|
|
else if (!string.IsNullOrWhiteSpace(Model.LoginUrl)) |
|
|
|
{ |
|
|
|
<div class="text-right"> |
|
|
|
<a href="@Model.LoginUrl" class="btn btn-primary"> @L["LoginToAddComment"]</a> |
|
|
|
</div> |
|
|
|
} |
|
|
|
</div> |
|
|
|
@foreach (var comment in Model.Comments) |
|
|
|
{ |
|
|
|
<div class="comment"> |
|
|
|
@ -131,7 +147,8 @@ |
|
|
|
@await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new {entityType = "comment", entityId = comment.Id.ToString()}) |
|
|
|
} |
|
|
|
|
|
|
|
@GetCommentActionArea(comment.Id, comment.Author.Id, false, comment.Text).Invoke(null) |
|
|
|
@GetCommentActionArea(comment.Id, comment.Author.Id, false).Invoke(null) |
|
|
|
@GetEditArea(comment.Id, comment.Text).Invoke(null) |
|
|
|
|
|
|
|
@if (comment.Replies.Any()) |
|
|
|
{ |
|
|
|
@ -152,7 +169,8 @@ |
|
|
|
@await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new {entityType = "comment", entityId = reply.Id.ToString()}) |
|
|
|
} |
|
|
|
|
|
|
|
@GetCommentActionArea(reply.Id, reply.Author.Id, true, reply.Text).Invoke(null) |
|
|
|
@GetCommentActionArea(reply.Id, reply.Author.Id, true).Invoke(null) |
|
|
|
@GetEditArea(reply.Id, reply.Text).Invoke(null) |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -160,23 +178,23 @@ |
|
|
|
@if (comment.Replies.Count >= 5) |
|
|
|
{ |
|
|
|
<div class="text-right mt-4"> |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
<a href="#" class="comment-reply-link btn btn-sm btn-primary" data-reply-id="@comment.Id.ToString()"> |
|
|
|
<i class="fa fa-reply mr-1"></i> @L["Reply"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
<a href="@(Model.LoginUrl + "_" + comment.Id)" class="btn btn-sm btn-primary shadow-sm"> @L["LoginToReply"]</a> |
|
|
|
} |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
<a href="#" class="comment-reply-link btn btn-sm btn-primary" data-reply-id="@comment.Id.ToString()"> |
|
|
|
<i class="fa fa-reply mr-1"></i> @L["Reply"] |
|
|
|
</a> |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
<a href="@(Model.LoginUrl + "_" + comment.Id)" class="btn btn-sm btn-primary shadow-sm"> @L["LoginToReply"]</a> |
|
|
|
} |
|
|
|
</div> |
|
|
|
} |
|
|
|
} |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
@GetCommentArea(comment.Id, true).Invoke(null) |
|
|
|
} |
|
|
|
@if (CurrentUser.IsAuthenticated) |
|
|
|
{ |
|
|
|
@GetCommentArea(comment.Id, true).Invoke(null) |
|
|
|
} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|