--HG--
branch : dev
This commit is contained in:
Renaud Paquay 2010-07-17 13:58:08 -07:00
commit 82ddb5d4c7
5 changed files with 57 additions and 22 deletions
src/Orchard.Web
Core/Contents
Controllers
Views/Admin
Modules/Orchard.Blogs

View File

@ -7,7 +7,6 @@ using System.Web.Routing;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.Records;
using Orchard.Core.Common.Models;
using Orchard.Core.Contents.ViewModels;
using Orchard.Data;
@ -76,7 +75,7 @@ namespace Orchard.Core.Contents.Controllers {
[HttpPost, ActionName("List")]
[FormValueRequired("submit.BulkEdit")]
public ActionResult ListPOST(ContentOptions options, IEnumerable<int> itemIds) {
public ActionResult ListPOST(ContentOptions options, IEnumerable<int> itemIds, string returnUrl) {
switch (options.BulkAction) {
case ContentsBulkAction.None:
break;
@ -114,7 +113,9 @@ namespace Orchard.Core.Contents.Controllers {
throw new ArgumentOutOfRangeException();
}
// todo: persist filter & order
if (!String.IsNullOrEmpty(returnUrl))
return Redirect(returnUrl);
return RedirectToAction("List");
}

View File

@ -1,17 +1,17 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.ListContentsViewModel>" %>
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
<h1><%:Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString())%></h1>
<h1><%:Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString()) %></h1>
<div class="manage">
<%:Html.ActionLink(!string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Add new {0} content", Model.TypeDisplayName).Text : T("Add new content").Text, "Create", new { }, new { @class = "button primaryAction" })%>
<%:Html.ActionLink(!string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Add new {0} content", Model.TypeDisplayName).Text : T("Add new content").Text, "Create", new { }, new { @class = "button primaryAction" }) %>
</div><%
using (Html.BeginFormAntiForgeryPost()) { %>
using (Html.BeginFormAntiForgeryPost()) { %>
<fieldset class="bulk-actions">
<label for="publishActions"><%:T("Actions:")%></label>
<label for="publishActions"><%:T("Actions:") %></label>
<select id="publishActions" name="<%:Html.NameOf(m => m.Options.BulkAction) %>">
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString())%>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString())%>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString())%>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString())%>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString()) %>
</select>
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
</fieldset>
@ -35,6 +35,6 @@ using (Html.BeginFormAntiForgeryPost()) { %>
<%:Html.UnorderedList(
Model.Entries,
(entry, i) => Html.DisplayForItem(entry.ViewModel),
"")%>
"") %>
</fieldset><%
} %>

View File

@ -6,6 +6,7 @@ using Orchard.Blogs.Models;
using Orchard.Blogs.Services;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Contents.ViewModels;
using Orchard.Localization;
using Orchard.Mvc.ViewModels;
@ -20,13 +21,11 @@ namespace Orchard.Blogs.Drivers {
};
private readonly IContentManager _contentManager;
private readonly IBlogService _blogService;
private readonly IBlogPostService _blogPostService;
public BlogDriver(IOrchardServices services, IContentManager contentManager, IBlogService blogService, IBlogPostService blogPostService) {
public BlogDriver(IOrchardServices services, IContentManager contentManager, IBlogPostService blogPostService) {
Services = services;
_contentManager = contentManager;
_blogService = blogService;
_blogPostService = blogPostService;
T = NullLocalizer.Instance;
}
@ -78,7 +77,19 @@ namespace Orchard.Blogs.Drivers {
ContentPartTemplate(blog, "Parts/Blogs.Blog.Manage").Location("manage"),
ContentPartTemplate(blog, "Parts/Blogs.Blog.Metadata").Location("metadata"),
ContentPartTemplate(blog, "Parts/Blogs.Blog.Description").Location("primary"),
blogPosts == null ? null : ContentPartTemplate(blogPosts, "Parts/Blogs.BlogPost.List", "").Location("primary"));
blogPosts == null
? null
: ContentPartTemplate(
new ListContentsViewModel {
ContainerId = blog.Id,
Entries = blogPosts.Select(bp => new ListContentsViewModel.Entry {
ContentItem = bp.Item.ContentItem,
ContentItemMetadata = _contentManager.GetItemMetadata(bp.Item.ContentItem),
ViewModel = bp
}).ToList()
},
"Parts/Blogs.BlogPost.List",
"").Location("primary"));
}
protected override DriverResult Editor(Blog blog) {

View File

@ -16,6 +16,6 @@
</fieldset>
</div>
</form>--%>
<div class="actions"><a href="<%: Url.BlogPostCreate(Model.Item) %>" class="add button primaryAction"><%: T("New Post")%></a></div>
<div class="manage"><a href="<%: Url.BlogPostCreate(Model.Item) %>" class="add button primaryAction"><%: T("New Post")%></a></div>
<% Html.Zone("primary");
Html.ZonesAny(); %>

View File

@ -1,5 +1,28 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<ContentItemViewModel<BlogPost>>>" %>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %>
<% if (Model.Count() < 1) { %><div class="info message"><%: T("There are no posts for this blog.") %></div><% } %>
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentsViewModel>" %>
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
<%@ Import Namespace="Orchard.Utility.Extensions" %>
<%
if (Model.Entries.Count() < 1) { %>
<div class="info message"><%:T("There are no posts for this blog.") %></div><%
}
else {
using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %>
<fieldset class="bulk-actions">
<label for="publishActions"><%:T("Actions:") %></label>
<select id="publishActions" name="<%:Html.NameOf(m => m.Options.BulkAction) %>">
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) %>
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString()) %>
</select>
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %>
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
</fieldset>
<fieldset class="contentItems bulk-items">
<%:Html.UnorderedList(
Model.Entries,
(entry, i) => Html.DisplayForItem(entry.ViewModel),
"") %>
</fieldset><%
}
} %>