From dd7b7188526daebf4f4c7b173254d7b3d90794ab Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 30 Nov 2010 18:17:00 -0800 Subject: [PATCH] Filtering user defined content parts for editing Work Item: 16710 --HG-- branch : dev --- .../Orchard.ContentTypes/Controllers/AdminController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs index a26c88a73..a7a8e7840 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Web.Mvc; using Orchard.ContentManagement; +using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.MetaData.Models; using Orchard.ContentTypes.Services; using Orchard.ContentTypes.ViewModels; @@ -12,10 +13,12 @@ using Orchard.UI.Notify; namespace Orchard.ContentTypes.Controllers { public class AdminController : Controller, IUpdateModel { private readonly IContentDefinitionService _contentDefinitionService; + private readonly IContentDefinitionManager _contentDefinitionManager; - public AdminController(IOrchardServices orchardServices, IContentDefinitionService contentDefinitionService) { + public AdminController(IOrchardServices orchardServices, IContentDefinitionService contentDefinitionService, IContentDefinitionManager contentDefinitionManager) { Services = orchardServices; _contentDefinitionService = contentDefinitionService; + _contentDefinitionManager = contentDefinitionManager; T = NullLocalizer.Instance; } @@ -222,7 +225,8 @@ namespace Orchard.ContentTypes.Controllers { public ActionResult ListParts() { return View(new ListContentPartsViewModel { - Parts = _contentDefinitionService.GetParts() + // only user-defined parts (not code as they are not configurable) + Parts = _contentDefinitionManager.ListPartDefinitions().Select(cpd => new EditPartViewModel(cpd)) }); }