From 1dfdeb8d802af10cb5ba32a0dab47c0e67c2f6a3 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Fri, 26 Feb 2010 15:57:23 -0800 Subject: [PATCH] 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 --- .../Parts/Comments.HasComments.ascx | 88 ++++++++----------- src/Orchard.Web/Themes/Green/Styles/site.css | 6 +- .../Parts/Comments.HasComments.ascx | 42 --------- 3 files changed, 44 insertions(+), 92 deletions(-) delete mode 100644 src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Parts/Comments.HasComments.ascx diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx b/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx index 99fd0f211..102e41dec 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx +++ b/src/Orchard.Web/Modules/Orchard.Comments/Views/DisplayTemplates/Parts/Comments.HasComments.ascx @@ -1,60 +1,50 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> <%@ Import Namespace="Orchard.Security" %> -<%@ Import Namespace="Orchard.Comments.Models" %> -

- <%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%>

-<% - if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); } - if (Model.CommentsActive == false) { %> -

- <%=_Encoded("Comments have been disabled for this content.") %>

-<% +<%@ Import Namespace="Orchard.Comments.Models" %><% +if (Model.Comments.Count > 0) { %> +

<%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%>

<% Html.RenderPartial("ListOfComments", Model.Comments); } +if (Model.CommentsActive == false) { + if (Model.Comments.Count > 0) { %> +

<%=_Encoded("Comments have been disabled for this content.") %>

<% } - else { %> +} +else { %> <% using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) { %> -<%=Html.ValidationSummary() %> -<% + <%=Html.ValidationSummary() %> +

<%=_Encoded("Add a Comment") %>

<% if (!Request.IsAuthenticated) { %> -
-
- - -
-
- - -
-
- - -
-
-<% +
+
+ + +
+
+ + +
+
+ + +
+
<% } else { var currentUser = Html.Resolve().GetAuthenticatedUser(); %> - <%=Html.Hidden("Name", currentUser.UserName ?? "")%> - <%=Html.Hidden("Email", currentUser.Email ?? "")%> -<% + <%=Html.Hidden("Name", currentUser.UserName ?? "")%> + <%=Html.Hidden("Email", currentUser.Email ?? "")%><% }%> -
-
- - -
-
- " /> - <%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %> - <%=Html.Hidden("ReturnUrl", Context.Request.Url) %> - <%=Html.AntiForgeryTokenOrchard() %> -
-
-<% +
+
+ + +
+
+ " /> + <%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %> + <%=Html.Hidden("ReturnUrl", Context.Request.Url) %> + <%=Html.AntiForgeryTokenOrchard() %> +
+
<% } - } %> +} %> \ No newline at end of file diff --git a/src/Orchard.Web/Themes/Green/Styles/site.css b/src/Orchard.Web/Themes/Green/Styles/site.css index dce904dec..5055311d8 100644 --- a/src/Orchard.Web/Themes/Green/Styles/site.css +++ b/src/Orchard.Web/Themes/Green/Styles/site.css @@ -70,7 +70,11 @@ fieldset { -moz-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} legend { diff --git a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Parts/Comments.HasComments.ascx b/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Parts/Comments.HasComments.ascx deleted file mode 100644 index 1301d25bd..000000000 --- a/src/Orchard.Web/Themes/Green/Views/DisplayTemplates/Parts/Comments.HasComments.ascx +++ /dev/null @@ -1,42 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Comments.Models"%> -

<%=_Encoded("{0} Comment{1}", Model.Comments.Count, Model.Comments.Count == 1 ? "" : "s")%>

<% -if (Model.Comments.Count > 0) { Html.RenderPartial("ListOfComments", Model.Comments); } -if (Model.CommentsActive == false) { %> -

<%=_Encoded("Comments have been disabled for this content.") %>

<% -} 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() %> -

Add a Comment

-
- - <%=Html.Hidden("CommentedOn", Model.ContentItem.Id) %> - <%=Html.Hidden("ReturnUrl", Context.Request.Url) %> -
- - -
-
- - -
-
- - -
- -
- - -
- -
- " /> - <%=Html.AntiForgeryTokenOrchard() %> -
-
<% - } -} %> - - \ No newline at end of file