diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ListPartDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ListPartDisplayDriver.cs index 9ad53a59351..af54c41227c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ListPartDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ListPartDisplayDriver.cs @@ -49,6 +49,7 @@ public override IDisplayResult Display(ListPart listPart, BuildPartDisplayContex InitializeDisplayListPartDisplayShape(listPart, context), InitializeDisplayListPartDetailAdminShape(listPart, context), InitializeDisplayListPartNavigationAdminShape(listPart, context, settings), + InitializeDisplayListPartDetailAdminSearchPanelShape(), InitializeDisplayListPartHeaderAdminShape(listPart, settings), InitializeDisplayListPartSummaryAdmin(listPart) ); @@ -134,6 +135,17 @@ private ShapeResult InitializeDisplayListPartDetailAdminShape(ListPart listPart, })) .Location("DetailAdmin", "Content:10"); } + private ShapeResult InitializeDisplayListPartDetailAdminSearchPanelShape() + { + return Initialize("ListPartDetailAdminSearchPanel", async model => + { + var listPartFilterViewModel = new ListPartFilterViewModel(); + await _updateModelAccessor.ModelUpdater.TryUpdateModelAsync(listPartFilterViewModel, Prefix); + + model.ListPartFilterViewModel = listPartFilterViewModel; + + }).Location("DetailAdmin", "Content:5"); + } private ShapeResult InitializeDisplayListPartDisplayShape(ListPart listPart, BuildPartDisplayContext context) { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdmin.cshtml index 64157790c6d..1eab4391aa4 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdmin.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdmin.cshtml @@ -1,13 +1,5 @@ -@using OrchardCore.Contents -@using OrchardCore.Lists.ViewModels -@using System.Globalization -@using OrchardCore.Localization -@using Microsoft.AspNetCore.Authorization @model OrchardCore.Lists.ViewModels.ListPartViewModel - @inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager -@inject OrchardCore.ContentManagement.IContentManager ContentManager -@inject Microsoft.AspNetCore.Authorization.IAuthorizationService AuthorizationService @{ var enableOrdering = Model.EnableOrdering && @@ -19,28 +11,7 @@ { } - - var authorizedContentTypeDefinitions = new List(); - - foreach (var contentTypeDefinition in Model.ContainedContentTypeDefinitions) - { - if (await AuthorizationService.AuthorizeAsync( - User, - CommonPermissions.EditContent, - await ContentManager.NewAsync(contentTypeDefinition.Name))) - { - authorizedContentTypeDefinitions.Add(contentTypeDefinition); - } - } - var dropdownClassList = new List() - { - "dropdown-menu" - }; - - if (CultureInfo.CurrentUICulture.IsRightToLeft()) - { - dropdownClassList.Add("dropdown-menu-start"); - } + } @if (!Model.ContainedContentTypeDefinitions.Any()) { @@ -50,30 +21,6 @@ } else { -
-
-
-
-
-
- - - - - -
-
-
-
-
-
@if (Model.ContentItems.Any()) { diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdminSearchPanel.cshtml b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdminSearchPanel.cshtml new file mode 100644 index 00000000000..5dd74af4b96 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartDetailAdminSearchPanel.cshtml @@ -0,0 +1,37 @@ +@using System.Globalization +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using OrchardCore.Lists.ViewModels +@using OrchardCore.Localization + +@model OrchardCore.Lists.ViewModels.ListPartViewModel + +@{ + var dropdownClassList = CultureInfo.CurrentUICulture.IsRightToLeft() + ? "dropdown-menu dropdown-menu-start" + : "dropdown-menu"; +} + +
+
+
+
+
+
+ +
+ @* Latest not surfaced here to be consistent with the main content items list filter. *@ + @T["Only draft items"] + @T["Only published items"] + @T["Owned by me"] +
+ + + +
+
+
+
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartNavigationAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartNavigationAdmin.cshtml index f048b58392b..c9b8b56e008 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartNavigationAdmin.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartNavigationAdmin.cshtml @@ -2,9 +2,20 @@ @using OrchardCore.ContentManagement @using OrchardCore.Contents @model OrchardCore.Lists.ViewModels.ListPartNavigationAdminViewModel -@inject OrchardCore.ContentManagement.IContentManager ContentManager -@inject Microsoft.AspNetCore.Authorization.IAuthorizationService AuthorizationService - +@inject IContentManager ContentManager +@inject IAuthorizationService AuthorizationService +@{ + var authorizedContentTypeDefinitions = new List(); + foreach (var contentTypeDefinition in Model.ContainedContentTypeDefinitions) + { + if (!await AuthorizationService.AuthorizeAsync(User, CommonPermissions.EditContent, await ContentManager.NewAsync(contentTypeDefinition.Name))) + { + continue; + } + + authorizedContentTypeDefinitions.Add(contentTypeDefinition); + } +}
@@ -21,9 +32,9 @@ } - @if (Model.ContainedContentTypeDefinitions.Length == 1) + @if (authorizedContentTypeDefinitions.Count == 1) { - var contentTypeDefinition = Model.ContainedContentTypeDefinitions[0]; + var contentTypeDefinition = authorizedContentTypeDefinitions.FirstOrDefault(); if (await AuthorizationService.AuthorizeContentTypeAsync(User, CommonPermissions.EditContent, contentTypeDefinition, User.Identity.Name)) { @@ -32,13 +43,13 @@ } } - else if (Model.ContainedContentTypeDefinitions.Length > 1) + else if (authorizedContentTypeDefinitions.Count > 1) {