diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index 0443510ea..88c85e965 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -84,7 +84,7 @@ namespace Orchard.Core.Contents.Controllers { //-- but resorting to - IEnumerable contentItems = query.List(); + var contentItems = query.List(); switch (model.Options.OrderBy) { case ContentsOrder.Modified: contentItems = contentItems.OrderByDescending(ci => ci.VersionRecord.Id); @@ -108,16 +108,21 @@ namespace Orchard.Core.Contents.Controllers { contentItems = contentItems.Skip(skip).Take(pageSize).ToList(); //model.Entries = contentItems.Select(BuildEntry).ToList(); - //model.Options.SelectedFilter = model.TypeName; - //model.Options.FilterOptions = GetCreatableTypes() - // .Select(ctd => new KeyValuePair(ctd.Name, ctd.DisplayName)) - // .ToList().OrderBy(kvp => kvp.Key); + model.Options.SelectedFilter = model.TypeName; + model.Options.FilterOptions = GetCreatableTypes() + .Select(ctd => new KeyValuePair(ctd.Name, ctd.DisplayName)) + .ToList().OrderBy(kvp => kvp.Key); + var list = Shape.List(); - foreach (var item in contentItems) - list.Add(Shape.Content(item)); + list.AddRange(contentItems); - return View(list); + var viewModel = Shape.ViewModel() + .ContentItems(list) + .Options(model.Options) + .TypeDisplayName(model.TypeDisplayName ?? ""); + + return View(viewModel); } private IEnumerable GetCreatableTypes() { diff --git a/src/Orchard.Web/Core/Contents/Views/Admin/List.cshtml b/src/Orchard.Web/Core/Contents/Views/Admin/List.cshtml index b007e135b..66b25c35d 100644 --- a/src/Orchard.Web/Core/Contents/Views/Admin/List.cshtml +++ b/src/Orchard.Web/Core/Contents/Views/Admin/List.cshtml @@ -1,35 +1,35 @@ @using Orchard.Core.Contents.ViewModels

@//Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString())

- @//Html.ActionLink(!string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Create New {0}", Model.TypeDisplayName).Text : T("Create New Content").Text, "Create", new { }, new { @class = "button primaryAction" }) + @Html.ActionLink((string)(!string.IsNullOrEmpty((string)Model.TypeDisplayName) ? T("Create New {0}", Model.TypeDisplayName).Text : T("Create New Content").Text), "Create", null, new { @class = "button primaryAction" })
@using (Html.BeginFormAntiForgeryPost()) {
- + @Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) + @Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) + @Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) + @Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString())
- + @Html.SelectOption((string)Model.Options.SelectedFilter, "", T("any (show all)").ToString()) + @foreach(var filterOption in Model.Options.FilterOptions) { + @Html.SelectOption((String)Model.Options.SelectedFilter, (string)filterOption.Key, (string)filterOption.Value) + } - + @Html.SelectOption((ContentsOrder)Model.Options.OrderBy, ContentsOrder.Created, T("recently created").ToString()) + @Html.SelectOption((ContentsOrder)Model.Options.OrderBy, ContentsOrder.Modified, T("recently modified").ToString())
- @Display(Model) +@Display(Model.ContentItems)
} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml b/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml index 4476e064a..29b96c2a3 100644 --- a/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml +++ b/src/Orchard.Web/Core/Shapes/Views/Layout.cshtml @@ -1,18 +1,17 @@ @// Html.RegisterStyle("site.css"); -
-
+ \ No newline at end of file diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 2f3b2da1a..36c3b35cb 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -315,7 +315,6 @@ - diff --git a/src/Orchard/DisplayManagement/Shapes/Shape.cs b/src/Orchard/DisplayManagement/Shapes/Shape.cs index d6c611e71..6de8bfae9 100644 --- a/src/Orchard/DisplayManagement/Shapes/Shape.cs +++ b/src/Orchard/DisplayManagement/Shapes/Shape.cs @@ -1,7 +1,5 @@ using System.Collections; using System.Collections.Generic; -using System.Linq; -using Microsoft.WebPages; namespace Orchard.DisplayManagement.Shapes { public class Shape : IShape, IEnumerable { @@ -26,6 +24,11 @@ namespace Orchard.DisplayManagement.Shapes { return this; } + public virtual Shape AddRange(IEnumerable items) { + ((List)_items).AddRange(items); + return this; + } + public virtual IEnumerator GetEnumerator() { return _items.GetEnumerator(); }