#21153 : [Feature] Dynamic AddComment.

Work Item: 21153
This commit is contained in:
Jay Harris
2015-02-14 16:12:54 +00:00
committed by agriffard
parent c8f65e7110
commit 13155e5b83

View File

@@ -7,8 +7,8 @@
CommentsPart commentsPart = Model.ContentPart;
bool canStillCommentOn = Model.CanStillComment;
var settings = commentsPart.TypePartDefinition.Settings.GetModel<CommentsPartSettings>();
var isAuthorized = AuthorizedFor(Permissions.AddComment, Model.ContentItem);
}
@if (!Model.ContentPart.CommentsActive || !canStillCommentOn) {
if (Model.ContentPart.Comments.Count > 0) {
<div id="comments">
@@ -16,17 +16,16 @@
</div>
}
}
else if (settings.MustBeAuthenticated && WorkContext.CurrentUser == null) {
<div id="comments">
<p class="comment-disabled">@T("You must be authenticated in order to add a comment.")</p>
</div>
}
else if (WorkContext.CurrentUser == null && !AuthorizedFor(Permissions.AddComment)) {
<h2 id="add-comment">@T("Add a Comment")</h2>
else if ((settings.MustBeAuthenticated || !isAuthorized) && WorkContext.CurrentUser == null) {
<p class="info message">@T("You must {0} to comment.", Html.ActionLink(T("log on").ToString(), "LogOn",
new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = string.Format("{0}#addacomment", Context.Request.RawUrl) }))</p>
}
else {
else if (WorkContext.CurrentUser != null && !isAuthorized) {
<div id="comments">
<p class="comment-disabled">@T("You are not authorized to add a comment.")</p>
</div>
}
else if (isAuthorized) {
@Html.ValidationSummary()
<span id="comment-form-beacon"></span>
using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Comment", new { Area = "Orchard.Comments", ReturnUrl = Context.Request.ToUrlString() }), FormMethod.Post, new { @class = "comment-form" })) {