--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-11-24 09:23:59 -08:00
10 changed files with 53 additions and 8 deletions

View File

@@ -135,7 +135,7 @@ namespace Orchard.Blogs.Controllers {
public ActionResult List() { public ActionResult List() {
var list = Services.New.List(); var list = Services.New.List();
list.AddRange(_blogService.Get() list.AddRange(_blogService.Get(VersionOptions.Latest)
.Select(b => { .Select(b => {
var blog = Services.ContentManager.BuildDisplay(b, "SummaryAdmin"); var blog = Services.ContentManager.BuildDisplay(b, "SummaryAdmin");
blog.TotalPostCount = _blogPostService.Get(b, VersionOptions.Latest).Count(); blog.TotalPostCount = _blogPostService.Get(b, VersionOptions.Latest).Count();

View File

@@ -29,7 +29,11 @@ namespace Orchard.Blogs.Services {
} }
public IEnumerable<BlogPart> Get() { public IEnumerable<BlogPart> Get() {
return _contentManager.Query<BlogPart, BlogPartRecord>() return Get(VersionOptions.Published);
}
public IEnumerable<BlogPart> Get(VersionOptions versionOptions) {
return _contentManager.Query<BlogPart, BlogPartRecord>(versionOptions)
.Join<RoutePartRecord>() .Join<RoutePartRecord>()
.OrderBy(br => br.Title) .OrderBy(br => br.Title)
.List(); .List();

View File

@@ -7,6 +7,7 @@ namespace Orchard.Blogs.Services {
BlogPart Get(string slug); BlogPart Get(string slug);
ContentItem Get(int id, VersionOptions versionOptions); ContentItem Get(int id, VersionOptions versionOptions);
IEnumerable<BlogPart> Get(); IEnumerable<BlogPart> Get();
IEnumerable<BlogPart> Get(VersionOptions versionOptions);
void Delete(ContentItem blog); void Delete(ContentItem blog);
} }
} }

View File

@@ -21,7 +21,6 @@
</div> </div>
<div class="related"> <div class="related">
@Display(Model.Actions) @Display(Model.Actions)
<a href="@Url.Blog(blog)" title="@T("View")">@T("View")</a>@T(" | ")
<a href="@Url.BlogForAdmin(blog)" title="@T("List Posts")">@T("List Posts")</a>@T(" | ") <a href="@Url.BlogForAdmin(blog)" title="@T("List Posts")">@T("List Posts")</a>@T(" | ")
<a href="@Url.BlogPostCreate(blog)" title="@T("New Post")">@T("New Post")</a>@T(" | ") <a href="@Url.BlogPostCreate(blog)" title="@T("New Post")">@T("New Post")</a>@T(" | ")
<a href="@Url.BlogEdit(blog)" title="@T("Edit")">@T("Edit")</a>@T(" | ") <a href="@Url.BlogEdit(blog)" title="@T("Edit")">@T("Edit")</a>@T(" | ")

View File

@@ -127,7 +127,11 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Content Include="Styles\Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -75,7 +75,7 @@ namespace Orchard.Comments.Services {
comment.Record.CommentText = context.CommentText; comment.Record.CommentText = context.CommentText;
comment.Record.Email = context.Email; comment.Record.Email = context.Email;
comment.Record.SiteName = context.SiteName; comment.Record.SiteName = context.SiteName;
comment.Record.UserName = (_orchardServices.WorkContext.CurrentUser == null ? context.Author : _orchardServices.WorkContext.CurrentUser.UserName); comment.Record.UserName = (_orchardServices.WorkContext.CurrentUser != null ? _orchardServices.WorkContext.CurrentUser.UserName : null);
comment.Record.CommentedOn = context.CommentedOn; comment.Record.CommentedOn = context.CommentedOn;
comment.Record.Status = _commentValidator.ValidateComment(comment) comment.Record.Status = _commentValidator.ValidateComment(comment)

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

View File

@@ -1,3 +1,13 @@
table.items .actions { table.items .actions {
white-space:nowrap; white-space:nowrap;
}
table.items tr {
background:#f7f7f7;
}
table.items tr.anonymous {
background:#fff;
}
.anonymous-commenter-id,
.authenticated-commenter-id {
font-style:italic;
} }

View File

@@ -53,7 +53,11 @@
</thead> </thead>
@{var commentIndex = 0;} @{var commentIndex = 0;}
@foreach (var commentEntry in Model.Comments) { @foreach (var commentEntry in Model.Comments) {
<tr itemscope="itemscope" itemid="@Model.Comments[commentIndex].Comment.Id" itemtype="http://orchardproject.net/data/Comment"> var commentClass = "";
if (!HasText(commentEntry.Comment.UserName)) {
commentClass = "anonymous";
}
<tr itemscope="itemscope" itemid="@Model.Comments[commentIndex].Comment.Id" itemtype="http://orchardproject.net/data/Comment" class="@commentClass">
<td> <td>
<input type="hidden" value="@Model.Comments[commentIndex].Comment.Id" name="@Html.NameOf(m => m.Comments[commentIndex].Comment.Id)"/> <input type="hidden" value="@Model.Comments[commentIndex].Comment.Id" name="@Html.NameOf(m => m.Comments[commentIndex].Comment.Id)"/>
<input type="checkbox" value="true" name="@Html.NameOf(m => m.Comments[commentIndex].IsChecked)"/> <input type="checkbox" value="true" name="@Html.NameOf(m => m.Comments[commentIndex].IsChecked)"/>
@@ -63,7 +67,12 @@
else if (commentEntry.Comment.Status == CommentStatus.Pending) { @T("Pending") } else if (commentEntry.Comment.Status == CommentStatus.Pending) { @T("Pending") }
else { @T("Approved") } else { @T("Approved") }
</td> </td>
<td>@commentEntry.Comment.UserName</td> <td>
<div>@commentEntry.Comment.Author</div>
@if (HasText(commentEntry.Comment.UserName) && commentEntry.Comment.Author != commentEntry.Comment.UserName) {
<div class="authenticated-commenter-id">@commentEntry.Comment.UserName</div>
}
</td>
<td> <td>
@* would ideally have permalinks for individual comments *@ @* would ideally have permalinks for individual comments *@
<p><a href="@Url.ItemDisplayUrl(commentEntry.CommentedOn)#comments"><time>@Html.DateTime(commentEntry.Comment.CommentDateUtc.GetValueOrDefault())</time></a></p> <p><a href="@Url.ItemDisplayUrl(commentEntry.CommentedOn)#comments"><time>@Html.DateTime(commentEntry.Comment.CommentDateUtc.GetValueOrDefault())</time></a></p>

View File

@@ -7,7 +7,7 @@
<article class="comment"> <article class="comment">
<header> <header>
<h4> <h4>
<span class="who">@Html.LinkOrDefault(comment.Record.UserName, comment.Record.SiteName, new { rel = "nofollow" }) <span class="who">@Html.LinkOrDefault(comment.Record.Author, comment.Record.SiteName, new { rel = "nofollow" })
</span> </span>
<span class="when">said <time datetime="@comment.Record.CommentDateUtc.GetValueOrDefault()">@Html.Link((string)Display.DateTimeRelative(dateTimeUtc: comment.Record.CommentDateUtc.GetValueOrDefault()).ToString(), "#")</time> <span class="when">said <time datetime="@comment.Record.CommentDateUtc.GetValueOrDefault()">@Html.Link((string)Display.DateTimeRelative(dateTimeUtc: comment.Record.CommentDateUtc.GetValueOrDefault()).ToString(), "#")</time>
</span> </span>