Add readonly support to CommentingViewComponent

pull/17925/head
Enis Necipoglu 2 years ago
parent 1c5789dd6a
commit 0289e15a8f
No known key found for this signature in database
GPG Key ID: 1EC55E13241E1680

@ -65,7 +65,13 @@
<abp-column size-md="_12">
@if (GlobalFeatureManager.Instance.IsEnabled<CommentsFeature>())
{
@await Component.InvokeAsync(typeof(CommentingViewComponent), new {entityType = "quote", entityId = "1", referralLinks = new [] {"nofollow"}})
@await Component.InvokeAsync(typeof(CommentingViewComponent), new
{
entityType = "quote",
entityId = "1",
isReadOnly = false,
referralLinks = new [] {"nofollow"}
})
}
</abp-column>
</abp-row>

@ -60,6 +60,7 @@ public class CommentingViewComponent : AbpViewComponent
public virtual async Task<IViewComponentResult> InvokeAsync(
string entityType,
string entityId,
bool isReadOnly,
IEnumerable<string> referralLinks = null)
{
referralLinks ??= Enumerable.Empty<string>();
@ -74,7 +75,8 @@ public class CommentingViewComponent : AbpViewComponent
EntityType = entityType,
ReferralLinks = referralLinks,
LoginUrl = loginUrl,
Comments = comments.OrderByDescending(i => i.CreationTime).ToList()
IsReadOnly = isReadOnly,
Comments = comments.OrderByDescending(i => i.CreationTime).ToList(),
};
await ConvertMarkdownTextsToHtml(viewModel);
@ -144,6 +146,8 @@ public class CommentingViewComponent : AbpViewComponent
public string Captcha { get; set; }
public string CaptchaImageBase64 { get; set; }
public bool IsReadOnly { get; set; }
}
}

@ -183,6 +183,8 @@
@GetCommentContentArea(comment.Id, comment.Text).Invoke(null)
@if (!Model.Input.IsReadOnly)
{
<div class="row mt-2">
<div class="col">
<div class="my-2 ">
@ -199,6 +201,7 @@
</div>
</div>
@GetEditArea(comment.Id, Model.Input.RawCommentTexts[comment.Id], comment.ConcurrencyStamp).Invoke(null)
}
@if (comment.Replies.Any())
{
@ -212,6 +215,8 @@
@GetCommentContentArea(reply.Id, reply.Text).Invoke(null)
@if (!Model.Input.IsReadOnly)
{
<div class="row mt-2">
<div class="col">
<div class="my-2 ">
@ -229,6 +234,7 @@
</div>
@GetEditArea(reply.Id, Model.Input.RawCommentTexts[reply.Id], reply.ConcurrencyStamp).Invoke(null)
}
</div>
</div>
}

Loading…
Cancel
Save