From eb14188cccb83acec4bed99cea6351dd8f33106f Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 19 Jul 2010 10:08:41 -0700 Subject: [PATCH 1/5] Adding admin content list filter (by type) & sort --HG-- branch : dev --- .../Contents/Controllers/AdminController.cs | 34 +++++++++++++++++++ .../ViewModels/ListContentsViewModel.cs | 17 +++------- .../Core/Contents/Views/Admin/List.ascx | 26 +++++++------- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index 10d4bfbff..065886ae7 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -52,6 +52,19 @@ namespace Orchard.Core.Contents.Controllers { var query = _contentManager.Query(VersionOptions.Latest, _contentDefinitionManager.ListTypeDefinitions().Select(ctd => ctd.Name).ToArray()); + // Ordering + switch (model.Options.OrderBy) { + case ContentsOrder.Modified: + query = query.OrderByDescending(cr => cr.ModifiedUtc); + break; + case ContentsOrder.Published: + query = query.OrderByDescending(cr => cr.PublishedUtc); + break; + case ContentsOrder.Created: + query = query.OrderByDescending(cr => cr.CreatedUtc); + break; + } + if (!string.IsNullOrEmpty(model.TypeName)) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.TypeName); if (contentTypeDefinition == null) @@ -69,10 +82,31 @@ namespace Orchard.Core.Contents.Controllers { var contentItems = query.Slice(skip, pageSize); model.Entries = contentItems.Select(BuildEntry).ToList(); + model.Options.SelectedFilter = model.TypeName; + model.Options.FilterOptions = _contentDefinitionManager.ListTypeDefinitions() + .Select(ctd => new KeyValuePair(ctd.Name, ctd.DisplayName)) + .ToList().OrderBy(kvp => kvp.Key); return View("List", model); } + [HttpPost, ActionName("List")] + [FormValueRequired("submit.Filter")] + public ActionResult ListFilterPOST(ContentOptions options) { + var routeValues = ControllerContext.RouteData.Values; + if (options != null) { + routeValues["Options.OrderBy"] = options.OrderBy; //todo: don't hard-code the key + if (_contentDefinitionManager.ListTypeDefinitions().Any(ctd => string.Equals(ctd.Name, options.SelectedFilter, StringComparison.OrdinalIgnoreCase))) { + routeValues["id"] = options.SelectedFilter; + } + else { + routeValues.Remove("id"); + } + } + + return RedirectToAction("List", routeValues); + } + [HttpPost, ActionName("List")] [FormValueRequired("submit.BulkEdit")] public ActionResult ListPOST(ContentOptions options, IEnumerable itemIds, string returnUrl) { diff --git a/src/Orchard.Web/Core/Contents/ViewModels/ListContentsViewModel.cs b/src/Orchard.Web/Core/Contents/ViewModels/ListContentsViewModel.cs index 90d108797..dc910aec6 100644 --- a/src/Orchard.Web/Core/Contents/ViewModels/ListContentsViewModel.cs +++ b/src/Orchard.Web/Core/Contents/ViewModels/ListContentsViewModel.cs @@ -33,26 +33,19 @@ namespace Orchard.Core.Contents.ViewModels { public class ContentOptions { public ContentOptions() { - Filter = ContentsFilter.All; - Order = ContentsOrder.Modified; + OrderBy = ContentsOrder.Modified; BulkAction = ContentsBulkAction.None; } - public ContentsFilter Filter { get; set; } - public ContentsOrder Order { get; set; } + public string SelectedFilter { get; set; } + public IEnumerable> FilterOptions { get; set; } + public ContentsOrder OrderBy { get; set; } public ContentsBulkAction BulkAction { get; set; } } - public enum ContentsFilter { - All, - Page, - BlogPost - } - public enum ContentsOrder { Modified, Published, - Created, - Title + Created } public enum ContentsBulkAction { diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx b/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx index 9444bdf13..6095e8785 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx +++ b/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx @@ -15,23 +15,23 @@ using (Html.BeginFormAntiForgeryPost()) { %> -<%--
- - + <%:Html.SelectOption(Model.Options.SelectedFilter, "", T("Any (show all)").ToString()) %> + <% foreach(var filterOption in Model.Options.FilterOptions) { %> + <%:Html.SelectOption(Model.Options.SelectedFilter, filterOption.Key, filterOption.Value) %><% + } %> - + <%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Created, T("Date Created").ToString())%> + <%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Modified, T("Date Modified").ToString())%> + <%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Published, T("Date Published").ToString())%> - +
---%>
+
<%:Html.UnorderedList( Model.Entries, (entry, i) => Html.DisplayForItem(entry.ViewModel), From 9301e9eb0a0d8e01c1521e1e884700af3a97a73c Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 19 Jul 2010 11:13:23 -0700 Subject: [PATCH 2/5] Fixed the display of blog posts on a blog in all of the themes - added a default blog list template and remove all of the theme-specific part templates (which were all the same) --HG-- branch : dev --- .../Orchard.Blogs/Drivers/BlogDriver.cs | 2 +- .../Orchard.Blogs/Orchard.Blogs.csproj | 1 + .../Blogs.BlogPost.List.DetailAdmin.ascx | 28 +++++++++++++++++ .../Parts/Blogs.BlogPost.List.ascx | 31 ++----------------- src/Orchard.Web/Orchard.Web.csproj | 4 --- .../Parts/Blogs.BlogPost.List.ascx | 5 --- .../Parts/Blogs.BlogPost.List.ascx | 5 --- .../Parts/Blogs.BlogPost.List.ascx | 6 ---- .../Parts/Blogs.BlogPost.List.ascx | 6 ---- 9 files changed, 33 insertions(+), 55 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx delete mode 100644 src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx delete mode 100644 src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs index 3a5451ec0..eeb6d0f71 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs @@ -89,7 +89,7 @@ namespace Orchard.Blogs.Drivers { }).ToList() }, "Parts/Blogs.BlogPost.List", - "").Location("primary")); + "").LongestMatch(displayType, "DetailAdmin").Location("primary")); } protected override DriverResult Editor(Blog blog) { diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj index 53571cbfc..30df21d5f 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Orchard.Blogs.csproj @@ -134,6 +134,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx new file mode 100644 index 000000000..e60031c58 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.DetailAdmin.ascx @@ -0,0 +1,28 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %> +<%@ Import Namespace="Orchard.Utility.Extensions" %> +<% +if (Model.Entries.Count() < 1) { %> +
<%:T("There are no posts for this blog.") %>
<% +} +else { + using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %> +
+ + + <%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %> + +
+
+ <%:Html.UnorderedList( + Model.Entries, + (entry, i) => Html.DisplayForItem(entry.ViewModel), + "") %> +
<% + } +} %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx index e60031c58..0f938e631 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx @@ -1,28 +1,3 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %> -<%@ Import Namespace="Orchard.Utility.Extensions" %> -<% -if (Model.Entries.Count() < 1) { %> -
<%:T("There are no posts for this blog.") %>
<% -} -else { - using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %> -
- - - <%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %> - -
-
- <%:Html.UnorderedList( - Model.Entries, - (entry, i) => Html.DisplayForItem(entry.ViewModel), - "") %> -
<% - } -} %> \ No newline at end of file +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +<%: Html.UnorderedList(Model.Entries, (bp, i) => Html.DisplayForItem(bp.ViewModel), "blogPosts contentItems") %> +<% if (Model.Entries.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 0a9866d9b..7a429e52e 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -139,7 +139,6 @@ - @@ -157,7 +156,6 @@ - @@ -192,7 +190,6 @@ - @@ -237,7 +234,6 @@ - diff --git a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 3924f0158..000000000 --- a/src/Orchard.Web/Themes/Classic/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,5 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 3924f0158..000000000 --- a/src/Orchard.Web/Themes/ClassicDark/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,5 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 49c4749b7..000000000 --- a/src/Orchard.Web/Themes/Contoso/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,6 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> - -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> diff --git a/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx b/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx deleted file mode 100644 index 49c4749b7..000000000 --- a/src/Orchard.Web/Themes/Corporate/Views/DisplayTemplates/Parts/Blogs.BlogPost.List.ascx +++ /dev/null @@ -1,6 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl>>" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> -<%@ Import Namespace="Orchard.Blogs.Models"%> - -<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %> -<% if (Model.Count() < 1) { %>

<%: T("There are no posts for this blog.") %>

<% } %> From 3bf8517cb2ee6aa40cfc517704d61467bd6f7369 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 19 Jul 2010 11:50:13 -0700 Subject: [PATCH 3/5] Corrected none null asumptions when altering exiting Content Types with new Parts --HG-- branch : dev --- .../Core/PublishLater/ViewModels/PublishLaterViewModel.cs | 2 +- src/Orchard.Web/Core/Routable/Services/RoutableService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Core/PublishLater/ViewModels/PublishLaterViewModel.cs b/src/Orchard.Web/Core/PublishLater/ViewModels/PublishLaterViewModel.cs index a0860ec68..67b8ff18f 100644 --- a/src/Orchard.Web/Core/PublishLater/ViewModels/PublishLaterViewModel.cs +++ b/src/Orchard.Web/Core/PublishLater/ViewModels/PublishLaterViewModel.cs @@ -33,7 +33,7 @@ namespace Orchard.Core.PublishLater.ViewModels { get { return IsPublished || ContentItem.ContentManager.Get(ContentItem.Id, VersionOptions.Published) != null; } } - public DateTime? VersionPublishedUtc { get { return ContentItem.As().VersionPublishedUtc; } } + public DateTime? VersionPublishedUtc { get { return ContentItem.As() == null ? null : ContentItem.As().VersionPublishedUtc; } } public DateTime? ScheduledPublishUtc { get; set; } diff --git a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs b/src/Orchard.Web/Core/Routable/Services/RoutableService.cs index 69a3fe436..6ddaf2d02 100644 --- a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs +++ b/src/Orchard.Web/Core/Routable/Services/RoutableService.cs @@ -63,10 +63,10 @@ namespace Orchard.Core.Routable.Services { public IEnumerable GetSimilarSlugs(string contentType, string slug) { return - _contentManager.Query(contentType).Join() + _contentManager.Query().Join() .List() .Select(i => i.As()) - .Where(routable => routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith + .Where(routable => routable.Path != null && routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith .ToArray(); } From 5fee44ffb3a6878daa00709d854ad975a9915ca2 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 19 Jul 2010 13:27:16 -0700 Subject: [PATCH 4/5] Don't recreate tables if an error occured during the second phase setup (homepage creation) --HG-- branch : dev --- .../Orchard.Setup/Services/SetupService.cs | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index 439212369..7e70e6e8c 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -8,6 +8,7 @@ using Orchard.Core.Common.Models; using Orchard.Core.Common.Settings; using Orchard.Core.Navigation.Models; using Orchard.Core.Routable.Models; +using Orchard.Core.Settings.Descriptor.Records; using Orchard.Core.Settings.Models; using Orchard.Data; using Orchard.Data.Migration.Interpreters; @@ -108,28 +109,36 @@ namespace Orchard.Setup.Services { // initialize database explicitly, and store shell descriptor var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellToplogy); - using (var environment = new StandaloneEnvironment(bootstrapLifetimeScope)) { + using ( var environment = new StandaloneEnvironment(bootstrapLifetimeScope) ) { - var schemaBuilder = new SchemaBuilder(environment.Resolve() ); - var reportsCoordinator = environment.Resolve(); + // check if the database is already created (in case an exception occured in the second phase) + var shellDescriptorRepository = environment.Resolve>(); + try { + shellDescriptorRepository.Get(x => true); + } + catch { + var schemaBuilder = new SchemaBuilder(environment.Resolve()); + var reportsCoordinator = environment.Resolve(); - reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation"); + reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation"); - schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table - .Column("Id", column => column.PrimaryKey().Identity()) - .Column("DataMigrationClass") - .Column("Version")); + schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", + table => table + .Column("Id", column => column.PrimaryKey().Identity()) + .Column("DataMigrationClass") + .Column("Version")); - var dataMigrationManager = environment.Resolve(); + var dataMigrationManager = environment.Resolve(); - foreach ( var feature in context.EnabledFeatures ) { - dataMigrationManager.Update(feature); - } + foreach ( var feature in context.EnabledFeatures ) { + dataMigrationManager.Update(feature); + } - environment.Resolve().UpdateShellDescriptor( - 0, - shellDescriptor.Features, - shellDescriptor.Parameters); + environment.Resolve().UpdateShellDescriptor( + 0, + shellDescriptor.Features, + shellDescriptor.Parameters); + } } // in effect "pump messages" see PostMessage circa 1980 From f5e80a308ed7dc52e84f10f2d79b2cb510411d2e Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 19 Jul 2010 13:53:46 -0700 Subject: [PATCH 5/5] Updated the admin content item list ordering to not exclude any items - having to make the orderby join free and roughly order by content version id to get created and modified order. this is also now doing an order and skip/take after running the query up to that point so it's also not ideal for perf --HG-- branch : dev --- .../Contents/Controllers/AdminController.cs | 52 ++++++++++++++----- .../Core/Contents/Views/Admin/List.ascx | 6 +-- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index 065886ae7..980b3e71a 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -52,19 +52,6 @@ namespace Orchard.Core.Contents.Controllers { var query = _contentManager.Query(VersionOptions.Latest, _contentDefinitionManager.ListTypeDefinitions().Select(ctd => ctd.Name).ToArray()); - // Ordering - switch (model.Options.OrderBy) { - case ContentsOrder.Modified: - query = query.OrderByDescending(cr => cr.ModifiedUtc); - break; - case ContentsOrder.Published: - query = query.OrderByDescending(cr => cr.PublishedUtc); - break; - case ContentsOrder.Created: - query = query.OrderByDescending(cr => cr.CreatedUtc); - break; - } - if (!string.IsNullOrEmpty(model.TypeName)) { var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.TypeName); if (contentTypeDefinition == null) @@ -79,7 +66,44 @@ namespace Orchard.Core.Contents.Controllers { if (model.ContainerId != null) query = query.Join().Where(cr => cr.Container.Id == model.ContainerId); - var contentItems = query.Slice(skip, pageSize); + // Ordering + //-- want something like + //switch (model.Options.OrderBy) { + // case ContentsOrder.Modified: + // query = query.OrderByDescending(cr => cr.ModifiedUtc); + // break; + // case ContentsOrder.Published: + // query = query.OrderByDescending(cr => cr.PublishedUtc); + // break; + // case ContentsOrder.Created: + // query = query.OrderByDescending(cr => cr.CreatedUtc); + // break; + //} + + //-- but resorting to + + IEnumerable contentItems = query.List(); + switch (model.Options.OrderBy) { + case ContentsOrder.Modified: + contentItems = contentItems.OrderByDescending(ci => ci.VersionRecord.Id); + break; + //case ContentsOrder.Published: + // would be lying w/out a published date instead of a bool but that only comes with the common aspect + // contentItems = contentItems.OrderByDescending(ci => ci.VersionRecord.Published/*Date*/); + // break; + case ContentsOrder.Created: + contentItems = contentItems.OrderByDescending(ci => ci.Id); + break; + } + + //-- for the moment + //-- because I'd rather do this + + //var contentItems = query.Slice(skip, pageSize); + + //-- instead of this (having the ordering and skip/take after the query) + + contentItems = contentItems.Skip(skip).Take(pageSize); model.Entries = contentItems.Select(BuildEntry).ToList(); model.Options.SelectedFilter = model.TypeName; diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx b/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx index 6095e8785..f33281c6c 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx +++ b/src/Orchard.Web/Core/Contents/Views/Admin/List.ascx @@ -25,9 +25,9 @@ using (Html.BeginFormAntiForgeryPost()) { %>