UI cleanup pass (progress - Orchard.Comments)

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045103
This commit is contained in:
skewed
2010-01-07 16:02:50 +00:00
parent fab0f1bede
commit a8541b386b
12 changed files with 162 additions and 142 deletions

View File

@@ -423,20 +423,28 @@ fieldset {
margin:0 0 1em; margin:0 0 1em;
padding:0; padding:0;
} }
form.comments {
/* Comments
----------------------------------------------------------*/
ul.comments {
padding:0;
}
ul.comments li {
list-style-type:none;
}
form.comment {
overflow:hidden; overflow:hidden;
} }
form.comments fieldset.who, form.comments fieldset.what { form.comment fieldset.who, form.comment fieldset.what {
float:left; float:left;
margin-right:15px; margin-right:15px;
} }
form.comments label { form.comment label {
font-weight:bold; font-weight:bold;
margin-top:15px; margin-top:15px;
} }
form.comments .button { form.comment .button {
margin-top:15px; margin-top:15px;
} }
/* Tag cloud /* Tag cloud

View File

@@ -12,12 +12,13 @@ namespace Orchard.Comments.Controllers {
// todo: (heskew) need to be more flexible with displaying parts somehow. e.g. where should the... // todo: (heskew) need to be more flexible with displaying parts somehow. e.g. where should the...
// comment count go in any given skin or what if the skin builder doesn't want the count // comment count go in any given skin or what if the skin builder doesn't want the count
if (displayType.StartsWith("Detail")) { if (displayType.StartsWith("Detail")) {
return Combined( //return Combined(
ContentPartTemplate(part, "Parts/Comments.Count").Location("body", "above.5"), // ContentPartTemplate(part, "Parts/Comments.Count").Location("body", "above.5"),
ContentPartTemplate(part, "Parts/Comments.HasComments").Location("body", "below.5")); // ContentPartTemplate(part, "Parts/Comments.HasComments").Location("body", "below.5"));
return ContentPartTemplate(part, "Parts/Comments.HasComments").Location("primary", "after.5");
} }
return ContentPartTemplate(part, "Parts/Comments.Count").Location("body", "above.5"); return ContentPartTemplate(part, "Parts/Comments.Count").Location("primary", "before.5");
} }
protected override DriverResult Editor(HasComments part) { protected override DriverResult Editor(HasComments part) {

View File

@@ -90,11 +90,11 @@
<Content Include="Views\Admin\Details.aspx" /> <Content Include="Views\Admin\Details.aspx" />
<Content Include="Views\Admin\Edit.aspx" /> <Content Include="Views\Admin\Edit.aspx" />
<Content Include="Views\Admin\Index.aspx" /> <Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\Admin\Create.aspx" />
<Content Include="Views\DisplayTemplates\Parts\Comments.HasComments.ascx" /> <Content Include="Views\DisplayTemplates\Parts\Comments.HasComments.ascx" />
<Content Include="Views\DisplayTemplates\Parts\Comments.Count.ascx" /> <Content Include="Views\DisplayTemplates\Parts\Comments.Count.ascx" />
<Content Include="Views\EditorTemplates\Parts\Comments.SiteSettings.ascx" /> <Content Include="Views\EditorTemplates\Parts\Comments.SiteSettings.ascx" />
<Content Include="Views\EditorTemplates\Parts\Comments.HasComments.ascx" /> <Content Include="Views\EditorTemplates\Parts\Comments.HasComments.ascx" />
<Content Include="Views\ListOfComments.ascx" />
<Content Include="Web.config" /> <Content Include="Web.config" />
<Content Include="Views\Web.config" /> <Content Include="Views\Web.config" />
</ItemGroup> </ItemGroup>

View File

@@ -1,19 +0,0 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<CommentsCreateViewModel>" %>
<%@ Import Namespace="Orchard.Comments.ViewModels"%>
<h2><%=Html.TitleForPage("Add Comment") %></h2>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%=Html.ValidationSummary() %>
<fieldset class="who">
<label for="CommentName">Name</label>
<input id="CommentName" class="text" name="Name" type="text" value="<%=Model.Name %>" /><br />
<label for="CommentEmail">Email</label>
<input id="CommentEmail" class="text" name="Email" type="text" value="<%=Model.Email%>" /> <br />
<label for="CommentSiteName">SiteName</label>
<input id="CommentSiteName" class="text" name="SiteName" type="text" value="<%=Model.SiteName %>" />
</fieldset>
<fieldset class="what">
<label for="CommentText">Leave a comment</label>
<textarea id="CommentText" rows="10" cols="30" name="CommentText"><%=Model.CommentText %></textarea>
<input type="submit" class="button" value="Save" />
</fieldset>
<% } %>

View File

@@ -1,36 +1,36 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<CommentsDetailsViewModel>" %> <%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<CommentsDetailsViewModel>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<%@ Import Namespace="Orchard.Comments.ViewModels"%> <%@ Import Namespace="Orchard.Comments.ViewModels"%>
<h2><%=Html.TitleForPage(string.Format("Comments for {0}", Model.DisplayNameForCommentedItem)) %></h2> <h1><%=Html.TitleForPage(T("Comments for {0}", Model.DisplayNameForCommentedItem).ToString()) %></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %> <% using(Html.BeginFormAntiForgeryPost()) { %>
<%=Html.ValidationSummary() %> <%=Html.ValidationSummary() %>
<fieldset class="actions bulk"> <fieldset class="actions bulk">
<label for="publishActions">Actions: </label> <label for="publishActions"><%=_Encoded("Actions:") %></label>
<select id="publishActions" name="<%=Html.NameOf(m => m.Options.BulkAction)%>"> <select id="publishActions" name="<%=Html.NameOf(m => m.Options.BulkAction)%>">
<%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.None, "Choose action...")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.None, _Encoded("Choose action...").ToString())%>
<%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.Delete, "Delete")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.Delete, _Encoded("Delete").ToString())%>
<%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.MarkAsSpam, "Mark as Spam")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentDetailsBulkAction.MarkAsSpam, _Encoded("Mark as Spam").ToString())%>
</select> </select>
<input class="button roundCorners" type="submit" name="submit.BulkEdit" value="Apply" /> <input class="button" type="submit" name="submit.BulkEdit" value="<%=_Encoded("Apply") %>" />
</fieldset> </fieldset>
<fieldset class="actions bulk"> <fieldset class="actions bulk">
<label for="filterResults">Filter: </label> <label for="filterResults"><%=_Encoded("Filter:")%></label>
<select id="filterResults" name="<%=Html.NameOf(m => m.Options.Filter)%>"> <select id="filterResults" name="<%=Html.NameOf(m => m.Options.Filter)%>">
<%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.All, "All Comments")%> <%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.All, _Encoded("All Comments").ToString())%>
<%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.Approved, "Approved Comments")%> <%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.Approved, _Encoded("Approved Comments").ToString())%>
<%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.Spam, "Spam")%> <%=Html.SelectOption(Model.Options.Filter, CommentDetailsFilter.Spam, _Encoded("Spam").ToString())%>
</select> </select>
<input class="button roundCorners" type="submit" name="submit.Filter" value="Filter"/> <input class="button" type="submit" name="submit.Filter" value="<%=_Encoded("Filter") %>"/>
</fieldset> </fieldset>
<div class="manage"> <div class="manage">
<% if (Model.CommentsClosedOnItem) { <% if (Model.CommentsClosedOnItem) {
%><%=Html.ActionLink("Enable Comments", "Enable", new { commentedItemId = Model.CommentedItemId }, new { @class = "button" })%><% %><%=Html.ActionLink(T("Enable Comments").ToString(), "Enable", new { commentedItemId = Model.CommentedItemId }, new { @class = "button" })%><%
} else { } else {
%><%=Html.ActionLink("Close Comments", "Close", new { commentedItemId = Model.CommentedItemId }, new { @class = "button remove" })%><% %><%=Html.ActionLink(T("Close Comments").ToString(), "Close", new { commentedItemId = Model.CommentedItemId }, new { @class = "button remove" })%><%
} %> } %>
</div> </div>
<fieldset> <fieldset>
<table class="items" summary="This is a table of the comments in your application"> <table class="items" summary="<%=_Encoded("This is a table of the comments for the content item") %>">
<colgroup> <colgroup>
<col id="Col1" /> <col id="Col1" />
<col id="Col2" /> <col id="Col2" />
@@ -42,10 +42,10 @@
<thead> <thead>
<tr> <tr>
<th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th> <th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th>
<th scope="col">Status</th> <th scope="col"><%=_Encoded("Status") %></th>
<th scope="col">Author</th> <th scope="col"><%=_Encoded("Author") %></th>
<th scope="col">Comment</th> <th scope="col"><%=_Encoded("Comment") %></th>
<th scope="col">Date</th> <th scope="col"><%=_Encoded("Date") %></th>
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
</thead> </thead>
@@ -61,19 +61,17 @@
<input type="hidden" value="<%=Model.DisplayNameForCommentedItem %>" name="DisplayNameForCommentedtem" /> <input type="hidden" value="<%=Model.DisplayNameForCommentedItem %>" name="DisplayNameForCommentedtem" />
<input type="hidden" value="<%=Model.CommentedItemId %>" name="CommentedItemId" /> <input type="hidden" value="<%=Model.CommentedItemId %>" name="CommentedItemId" />
</td> </td>
<td><% if (commentEntry.Comment.Status == CommentStatus.Spam) {%> Spam <% } %> <td><% if (commentEntry.Comment.Status == CommentStatus.Spam) { %><%=_Encoded("Spam") %><% } else { %><%=_Encoded("Approved") %><% } %></td>
<% else {%> Approved <% } %> <td><%=Html.Encode(commentEntry.Comment.UserName) %></td>
</td>
<td><%= commentEntry.Comment.UserName %></td>
<td> <td>
<% if (commentEntry.Comment.CommentText != null) {%> <% if (commentEntry.Comment.CommentText != null) {%>
<%= commentEntry.Comment.CommentText.Length > 23 ? commentEntry.Comment.CommentText.Substring(0, 24) : commentEntry.Comment.CommentText %> ... <%=Html.Encode(commentEntry.Comment.CommentText.Length > 23 ? commentEntry.Comment.CommentText.Substring(0, 24) : commentEntry.Comment.CommentText) %><%=_Encoded(" ...") %>
<% } %> <% } %>
</td> </td>
<td><%=commentEntry.Comment.CommentDate.ToLocalTime() %></td> <td><%=commentEntry.Comment.CommentDate.ToLocalTime() %></td>
<td> <td>
<%=Html.ActionLink("Edit", "Edit", new {commentEntry.Comment.Id}) %> | <%=Html.ActionLink(T("Edit").ToString(), "Edit", new {commentEntry.Comment.Id}) %> |
<%=Html.ActionLink("Delete", "Delete", new {id = commentEntry.Comment.Id, redirectToAction = "Details"}) %> <%=Html.ActionLink(T("Delete").ToString(), "Delete", new {id = commentEntry.Comment.Id, redirectToAction = "Details"}) %>
</td> </td>
</tr> </tr>
<% <%
@@ -83,9 +81,9 @@
</fieldset> </fieldset>
<div class="manage"> <div class="manage">
<% if (Model.CommentsClosedOnItem) { <% if (Model.CommentsClosedOnItem) {
%><%=Html.ActionLink("Enable Comments", "Enable", new { commentedItemId = Model.CommentedItemId }, new { @class = "button" })%><% %><%=Html.ActionLink(T("Enable Comments").ToString(), "Enable", new { commentedItemId = Model.CommentedItemId }, new { @class = "button" })%><%
} else { } else {
%><%=Html.ActionLink("Close Comments", "Close", new { commentedItemId = Model.CommentedItemId }, new { @class = "button remove" })%><% %><%=Html.ActionLink(T("Close Comments").ToString(), "Close", new { commentedItemId = Model.CommentedItemId }, new { @class = "button remove" })%><%
} %> } %>
</div> </div>
<% } %> <% } %>

View File

@@ -1,31 +1,41 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<CommentsEditViewModel>" %> <%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<CommentsEditViewModel>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<%@ Import Namespace="Orchard.Comments.ViewModels"%> <%@ Import Namespace="Orchard.Comments.ViewModels"%>
<h2><%=Html.TitleForPage("Edit Comment")%></h2> <h1><%=Html.TitleForPage(T("Edit Comment").ToString())%></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %> <% using(Html.BeginFormAntiForgeryPost()) { %>
<%= Html.ValidationSummary() %> <%= Html.ValidationSummary() %>
<fieldset class="who"> <fieldset class="who">
<label for="CommentName">Name</label> <div>
<input id="CommentName" class="text" name="Name" type="text" value="<%=Model.Name %>" /><br /> <label for="Name"><%=_Encoded("Name") %></label>
<label for="CommentEmail">Email</label> <input id="Name" class="text" name="Name" type="text" value="<%=Html.Encode(Model.Name) %>" />
<input id="CommentEmail" class="text" name="Email" type="text" value="<%=Model.Email%>" /> <br /> </div>
<label for="CommentSiteName">SiteName</label> <div>
<input id="CommentSiteName" class="text" name="SiteName" type="text" value="<%=Model.SiteName %>" /> <label for="Email"><%=_Encoded("Email") %></label>
<input id="Email" class="text" name="Email" type="text" value="<%=Html.Encode(Model.Email)%>" />
</div>
<div>
<label for="SiteName"><%=_Encoded("Url") %></label>
<input id="SiteName" class="text" name="SiteName" type="text" value="<%=Html.Encode(Model.SiteName) %>" />
</div>
</fieldset> </fieldset>
<fieldset class="what"> <fieldset class="what">
<label for="CommentText">Leave a comment</label> <div>
<textarea id="Textarea1" rows="10" cols="30" name="CommentText"><%=Model.CommentText %></textarea> <label for="CommentText"><%=_Encoded("Body") %></label>
<textarea id="CommentText" rows="10" cols="30" name="CommentText"><%=Html.Encode(Model.CommentText) %></textarea>
<input id="CommentId" name="Id" type="hidden" value="<%=Model.Id %>" /> <input id="CommentId" name="Id" type="hidden" value="<%=Model.Id %>" />
</div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label for="Status_Approved"> <div>
<%=Html.RadioButton("Status", "Approved", (Model.Status == CommentStatus.Approved), new { id = "Status_Approved" }) %> Approved <%=Html.RadioButton("Status", "Approved", (Model.Status == CommentStatus.Approved), new { id = "Status_Approved" }) %>
</label> <label class="forcheckbox" for="Status_Approved"><%=_Encoded("Approved") %></label>
<label for="Status_Spam"> </div>
<%=Html.RadioButton("Status", "Spam", (Model.Status == CommentStatus.Spam), new { id = "Status_Spam" }) %> Mark As Spam <div>
</label> <%=Html.RadioButton("Status", "Spam", (Model.Status == CommentStatus.Spam), new { id = "Status_Spam" }) %>
<label class="forcheckbox" for="Status_Spam"><%=_Encoded("Mark as spam") %></label>
</div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<input type="submit" class="button" value="Save" /> <input type="submit" class="button" value="<%=_Encoded("Save") %>" />
</fieldset> </fieldset>
<% } %> <% } %>

View File

@@ -1,29 +1,29 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<CommentsIndexViewModel>" %> <%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<CommentsIndexViewModel>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<%@ Import Namespace="Orchard.Comments.ViewModels"%> <%@ Import Namespace="Orchard.Comments.ViewModels"%>
<h2><%=Html.TitleForPage("Manage Comments")%></h2> <h1><%=Html.TitleForPage(T("Manage Comments").ToString())%></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %> <% using(Html.BeginFormAntiForgeryPost()) { %>
<%=Html.ValidationSummary() %> <%=Html.ValidationSummary() %>
<fieldset class="actions bulk"> <fieldset class="actions bulk">
<label for="publishActions">Actions: </label> <label for="publishActions"><%=_Encoded("Actions:") %></label>
<select id="publishActions" name="<%=Html.NameOf(m => m.Options.BulkAction)%>"> <select id="publishActions" name="<%=Html.NameOf(m => m.Options.BulkAction)%>">
<%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.None, "Choose action...")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.None, _Encoded("Choose action...").ToString()) %>
<%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Delete, "Delete")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Delete, _Encoded("Delete").ToString())%>
<%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.MarkAsSpam, "Mark as Spam")%> <%=Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.MarkAsSpam, _Encoded("Mark as Spam").ToString()) %>
</select> </select>
<input class="button" type="submit" name="submit.BulkEdit" value="Apply" /> <input class="button" type="submit" name="submit.BulkEdit" value="<%=_Encoded("Apply") %>" />
</fieldset> </fieldset>
<fieldset class="actions bulk"> <fieldset class="actions bulk">
<label for="filterResults">Filter: </label> <label for="filterResults"><%=_Encoded("Filter:")%></label>
<select id="filterResults" name="<%=Html.NameOf(m => m.Options.Filter)%>"> <select id="filterResults" name="<%=Html.NameOf(m => m.Options.Filter)%>">
<%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.All, "All Comments")%> <%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.All, _Encoded("All Comments").ToString()) %>
<%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Approved, "Approved Comments")%> <%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Approved, _Encoded("Approved Comments").ToString()) %>
<%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Spam, "Spam")%> <%=Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Spam, _Encoded("Spam").ToString())%>
</select> </select>
<input class="button" type="submit" name="submit.Filter" value="Filter"/> <input class="button" type="submit" name="submit.Filter" value="<%=_Encoded("Filter") %>"/>
</fieldset> </fieldset>
<fieldset> <fieldset>
<table class="items" summary="This is a table of the comments in your application"> <table class="items" summary="<%=_Encoded("This is a table of the comments in your application") %>">
<colgroup> <colgroup>
<col id="Col1" /> <col id="Col1" />
<col id="Col2" /> <col id="Col2" />
@@ -36,11 +36,11 @@
<thead> <thead>
<tr> <tr>
<th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th> <th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th>
<th scope="col">Status</th> <th scope="col"><%=_Encoded("Status") %></th>
<th scope="col">Author</th> <th scope="col"><%=_Encoded("Author") %></th>
<th scope="col">Comment</th> <th scope="col"><%=_Encoded("Comment") %></th>
<th scope="col">Date</th> <th scope="col"><%=_Encoded("Date") %></th>
<th scope="col">Commented On</th> <th scope="col"><%=_Encoded("Commented On") %></th>
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
</thead> </thead>
@@ -54,22 +54,19 @@
<input type="hidden" value="<%=Model.Comments[commentIndex].Comment.Id %>" name="<%=Html.NameOf(m => m.Comments[ci].Comment.Id) %>"/> <input type="hidden" value="<%=Model.Comments[commentIndex].Comment.Id %>" name="<%=Html.NameOf(m => m.Comments[ci].Comment.Id) %>"/>
<input type="checkbox" value="true" name="<%=Html.NameOf(m => m.Comments[ci].IsChecked) %>"/> <input type="checkbox" value="true" name="<%=Html.NameOf(m => m.Comments[ci].IsChecked) %>"/>
</td> </td>
<td><% if (commentEntry.Comment.Status == CommentStatus.Spam) {%> Spam <% } %> <td><% if (commentEntry.Comment.Status == CommentStatus.Spam) { %><%=_Encoded("Spam") %><% } else { %><%=_Encoded("Approved") %><% } %></td>
<% else {%> Approved <% } %> <td><%=Html.Encode(commentEntry.Comment.UserName) %></td>
</td>
<td><%= commentEntry.Comment.UserName %></td>
<td> <td>
<% if (commentEntry.Comment.CommentText != null) {%> <% if (commentEntry.Comment.CommentText != null) {%>
<%= commentEntry.Comment.CommentText.Length > 23 ? commentEntry.Comment.CommentText.Substring(0, 24) : commentEntry.Comment.CommentText %> ... <%-- todo: (heskew) same text processing comment as on the public display, also need to use the ellipsis character instead of ... --%>
<%=Html.Encode(commentEntry.Comment.CommentText.Length > 23 ? commentEntry.Comment.CommentText.Substring(0, 24) : commentEntry.Comment.CommentText) %><%=_Encoded(" ...") %>
<% } %> <% } %>
</td> </td>
<td><%=commentEntry.Comment.CommentDate.ToLocalTime() %></td> <td><%=commentEntry.Comment.CommentDate.ToLocalTime() %></td>
<td><%=Html.ActionLink(commentEntry.CommentedOn, "Details", new { id = commentEntry.Comment.CommentedOn }) %></td>
<td> <td>
<%=Html.ActionLink(commentEntry.CommentedOn, "Details", new {id = commentEntry.Comment.CommentedOn}) %> <%=Html.ActionLink(T("Edit").ToString(), "Edit", new {commentEntry.Comment.Id}) %> |
</td> <%=Html.ActionLink(T("Delete").ToString(), "Delete", new { id = commentEntry.Comment.Id, redirectToAction = "Index" }) %>
<td>
<%=Html.ActionLink("Edit", "Edit", new {commentEntry.Comment.Id}) %> |
<%=Html.ActionLink("Delete", "Delete", new {id = commentEntry.Comment.Id, redirectToAction = "Index"}) %>
</td> </td>
</tr> </tr>
<% <%

View File

@@ -1,38 +1,38 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.CommentCount, Model.CommentCount == 1 ? "" : "s") %></h2><% <h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.CommentCount, Model.CommentCount == 1 ? "" : "s") %></h2><%
foreach (var comment in Model.Comments) { %> if (Model.CommentCount > 0) { Html.RenderPartial("ListOfComments", Model.Comments); }
<div>
<div class="comment">
<%--TODO: (erikpo) Need to clean the name and url so nothing dangerous goes out--%>
<span class="who"><%=Html.LinkOrDefault(comment.UserName, comment.SiteName, new { rel = "nofollow" })%></span>
<span>said <%=Html.Link(Html.DateTimeRelative(comment.CommentDate), "#")%></span>
</div>
<div class="text">
<p><%=Html.Encode(comment.CommentText) %></p>
</div>
</div><%
}
if (Model.CommentsActive == false) { %> if (Model.CommentsActive == false) { %>
<p>Comments have been disabled for this content.</p><% <p><%=_Encoded("Comments have been disabled for this content.") %></p><%
} else { %> } else { %>
<% using(Html.BeginForm("Create", "Admin", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comments" })) { %> <%-- 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() %> <%=Html.ValidationSummary() %>
<fieldset class="who"> <fieldset class="who">
<%= Html.Hidden("CommentedOn", Model.ContentItem.Id) %> <%= Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
<%= Html.Hidden("ReturnUrl", Context.Request.Url) %> <%= Html.Hidden("ReturnUrl", Context.Request.Url) %>
<label for="Name">Name</label> <div>
<input id="Name" class="text" name="Name" type="text" /><br /> <label for="Name"><%=_Encoded("Name") %></label>
<label for="Email">Email</label> <input id="Name" class="text" name="Name" type="text" />
<input id="Email" class="text" name="Email" type="text" /><br /> </div>
<label for="SiteName">Url</label> <div>
<input id="SiteName" class="text" name="SiteName" type="text" /><br /> <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>
</fieldset> </fieldset>
<fieldset class="what"> <fieldset class="what">
<label for="CommentText">Leave a comment</label> <div>
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea><br /> <label for="CommentText"><%=_Encoded("Leave a comment") %></label>
<input type="submit" class="button" value="Submit Comment" /> <textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
</div>
<div>
<input type="submit" class="button" value="<%=_Encoded("Submit Comment") %>" />
<%=Html.AntiForgeryTokenOrchard() %> <%=Html.AntiForgeryTokenOrchard() %>
</div>
</fieldset><% </fieldset><%
} }
} %> } %>

View File

@@ -0,0 +1,17 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<Comment>>" %>
<%@ Import Namespace="Orchard.Comments.Models"%>
<ul class="comments"><%
foreach (var comment in Model) { %>
<li>
<div class="comment">
<span class="who"><%=Html.LinkOrDefault(Html.Encode(comment.UserName), Html.Encode(comment.SiteName), new { rel = "nofollow" })%></span>
<%-- todo: (heskew) need comment permalink --%>
<span>said <%=Html.Link(Html.DateTimeRelative(comment.CommentDate), "#")%></span>
</div>
<div class="text">
<%-- todo: (heskew) comment text needs processing depending on comment markup style --%>
<p><%=Html.Encode(comment.CommentText) %></p>
</div>
</li><%
} %>
</ul>

View File

@@ -18,7 +18,7 @@ namespace Orchard.Tags.Controllers {
} }
protected override DriverResult Display(HasTags part, string displayType) { protected override DriverResult Display(HasTags part, string displayType) {
return ContentPartTemplate(part, "Parts/Tags.ShowTags").Location("body:above"); return ContentPartTemplate(part, "Parts/Tags.ShowTags").Location("primary", "49");
} }
protected override DriverResult Editor(HasTags part) { protected override DriverResult Editor(HasTags part) {

View File

@@ -423,20 +423,28 @@ fieldset {
margin:0 0 1em; margin:0 0 1em;
padding:0; padding:0;
} }
form.comments {
/* Comments
----------------------------------------------------------*/
ul.comments {
padding:0;
}
ul.comments li {
list-style-type:none;
}
form.comment {
overflow:hidden; overflow:hidden;
} }
form.comments fieldset.who, form.comments fieldset.what { form.comment fieldset.who, form.comment fieldset.what {
float:left; float:left;
margin-right:15px; margin-right:15px;
} }
form.comments label { form.comment label {
font-weight:bold; font-weight:bold;
margin-top:15px; margin-top:15px;
} }
form.comments .button { form.comment .button {
margin-top:15px; margin-top:15px;
} }
/* Tag cloud /* Tag cloud

View File

@@ -40,7 +40,7 @@ namespace Orchard.Mvc.Html {
#region UnorderedList #region UnorderedList
public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass) { public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass) {
return htmlHelper.UnorderedList(items, generateContent, cssClass, null, (string)null); return htmlHelper.UnorderedList(items, generateContent, cssClass, null, null);
} }
public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass, string itemCssClass, string alternatingItemCssClass) { public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass, string itemCssClass, string alternatingItemCssClass) {