mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Some comment display cleanup
- only show the [comment count] Comments heading if there are comments - only show the comments are disabled message if comments are disabled *and* there *are* comments - added an Add a Comment heading above the comment form --HG-- branch : dev
This commit is contained in:
@@ -1,60 +1,50 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
|
||||||
<%@ Import Namespace="Orchard.Security" %>
|
<%@ Import Namespace="Orchard.Security" %>
|
||||||
<%@ Import Namespace="Orchard.Comments.Models" %>
|
<%@ Import Namespace="Orchard.Comments.Models" %><%
|
||||||
<h2 id="comments">
|
if (Model.Comments.Count > 0) { %>
|
||||||
<%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%></h2>
|
<h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%></h2><% Html.RenderPartial("ListOfComments", Model.Comments); }
|
||||||
<%
|
if (Model.CommentsActive == false) {
|
||||||
if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); }
|
if (Model.Comments.Count > 0) { %>
|
||||||
if (Model.CommentsActive == false) { %>
|
<p><%=_Encoded("Comments have been disabled for this content.") %></p><%
|
||||||
<p>
|
|
||||||
<%=_Encoded("Comments have been disabled for this content.") %></p>
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
else { %>
|
}
|
||||||
|
else { %>
|
||||||
<% using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %>
|
<% using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %>
|
||||||
<%=Html.ValidationSummary() %>
|
<%=Html.ValidationSummary() %>
|
||||||
<%
|
<h2><%=_Encoded("Add a Comment") %></h2><%
|
||||||
if (!Request.IsAuthenticated) { %>
|
if (!Request.IsAuthenticated) { %>
|
||||||
<fieldset class="who">
|
<fieldset class="who">
|
||||||
<div>
|
<div>
|
||||||
<label for="Name">
|
<label for="Name"><%=_Encoded("Name") %></label>
|
||||||
<%=_Encoded("Name") %></label>
|
<input id="Name" class="text" name="Name" type="text" />
|
||||||
<input id="Name" class="text" name="Name" type="text" />
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<label for="Email"><%=_Encoded("Email") %></label>
|
||||||
<label for="Email">
|
<input id="Email" class="text" name="Email" type="text" />
|
||||||
<%=_Encoded("Email") %></label>
|
</div>
|
||||||
<input id="Email" class="text" name="Email" type="text" />
|
<div>
|
||||||
</div>
|
<label for="SiteName"><%=_Encoded("Url") %></label>
|
||||||
<div>
|
<input id="SiteName" class="text" name="SiteName" type="text" />
|
||||||
<label for="SiteName">
|
</div>
|
||||||
<%=_Encoded("Url") %></label>
|
</fieldset><%
|
||||||
<input id="SiteName" class="text" name="SiteName" type="text" />
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var currentUser = Html.Resolve<IAuthenticationService>().GetAuthenticatedUser();
|
var currentUser = Html.Resolve<IAuthenticationService>().GetAuthenticatedUser();
|
||||||
%>
|
%>
|
||||||
<%=Html.Hidden("Name", currentUser.UserName ?? "")%>
|
<%=Html.Hidden("Name", currentUser.UserName ?? "")%>
|
||||||
<%=Html.Hidden("Email", currentUser.Email ?? "")%>
|
<%=Html.Hidden("Email", currentUser.Email ?? "")%><%
|
||||||
<%
|
|
||||||
}%>
|
}%>
|
||||||
<fieldset class="what">
|
<fieldset class="what">
|
||||||
<div>
|
<div>
|
||||||
<label for="CommentText">
|
<label for="CommentText"><% if (Request.IsAuthenticated) { %><%=T("Hi, {0}!", Html.Encode(Page.User.Identity.Name)) %><br /><% } %><%=_Encoded("Comment") %></label>
|
||||||
<% if (Request.IsAuthenticated) { %><%=T("Hi, {0}!", Html.Encode(Page.User.Identity.Name)) %><br />
|
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
||||||
<% } %><%=_Encoded("Leave a comment") %></label>
|
</div>
|
||||||
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
<div>
|
||||||
</div>
|
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
||||||
<div>
|
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
||||||
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||||
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
<%=Html.AntiForgeryTokenOrchard() %>
|
||||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
</div>
|
||||||
<%=Html.AntiForgeryTokenOrchard() %>
|
</fieldset><%
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<%
|
|
||||||
}
|
}
|
||||||
} %>
|
} %>
|
@@ -70,7 +70,11 @@ fieldset {
|
|||||||
-moz-border-radius:6px;
|
-moz-border-radius:6px;
|
||||||
-webkit-border-radius:6px;
|
-webkit-border-radius:6px;
|
||||||
}
|
}
|
||||||
|
/* todo: (heskew) tmp. leaving it up to Jon on what he wants to do with this :P */
|
||||||
|
form.comment fieldset {
|
||||||
|
margin-bottom:0;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset div {margin:12px 0 0 0}
|
fieldset div {margin:12px 0 0 0}
|
||||||
|
|
||||||
legend {
|
legend {
|
||||||
|
@@ -1,42 +0,0 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
|
|
||||||
<%@ Import Namespace="Orchard.Comments.Models"%>
|
|
||||||
<h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%></h2><%
|
|
||||||
if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); }
|
|
||||||
if (Model.CommentsActive == false) { %>
|
|
||||||
<p><%=_Encoded("Comments have been disabled for this content.") %></p><%
|
|
||||||
} else { %>
|
|
||||||
<%-- todo: (heskew) need a comment form for the authenticated user... --%>
|
|
||||||
<% using(Html.BeginForm("Create", "Admin", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %>
|
|
||||||
<%=Html.ValidationSummary() %>
|
|
||||||
<h2>Add a Comment</h2>
|
|
||||||
<fieldset class="who">
|
|
||||||
|
|
||||||
<%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
|
||||||
<%=Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
|
||||||
<div>
|
|
||||||
<label for="Name"><%=_Encoded("Name") %></label>
|
|
||||||
<input id="Name" class="text" name="Name" type="text" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="Email"><%=_Encoded("Email") %></label>
|
|
||||||
<input id="Email" class="text" name="Email" type="text" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="SiteName"><%=_Encoded("Url") %></label>
|
|
||||||
<input id="SiteName" class="text" name="SiteName" type="text" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="CommentText"><%=_Encoded("Comment") %></label>
|
|
||||||
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
|
|
||||||
<%=Html.AntiForgeryTokenOrchard() %>
|
|
||||||
</div>
|
|
||||||
</fieldset><%
|
|
||||||
}
|
|
||||||
} %>
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user