From d2e93fd33b834275b1ddf1aa6f22492fc6cab862 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Fri, 2 Jul 2010 11:28:31 -0700 Subject: [PATCH] Added list of content parts --HG-- branch : dev --- .../Controllers/AdminController.cs | 6 ++++++ .../Orchard.ContentTypes/Orchard.ContentTypes.csproj | 3 +++ .../ViewModels/ListContentPartsViewModel.cs | 9 +++++++++ .../Orchard.ContentTypes/Views/Admin/List.ascx | 10 +++++----- .../Orchard.ContentTypes/Views/Admin/ListParts.ascx | 11 +++++++++++ .../Views/DisplayTemplates/ContentPartDefinition.ascx | 9 +++++++++ .../Views/DisplayTemplates/ContentTypeDefinition.ascx | 8 ++------ 7 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.ContentTypes/ViewModels/ListContentPartsViewModel.cs create mode 100644 src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/ListParts.ascx create mode 100644 src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentPartDefinition.ascx diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs index 92fdebbf9..11f04f725 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Controllers/AdminController.cs @@ -282,6 +282,12 @@ namespace Orchard.ContentTypes.Controllers { #region Parts + public ActionResult ListParts() { + return View(new ListContentPartsViewModel { + Parts = _contentDefinitionService.GetPartDefinitions() + }); + } + public ActionResult EditPart(string id) { if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part."))) return new HttpUnauthorizedResult(); diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj b/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj index 1d05c5039..b58355bd1 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj @@ -77,6 +77,7 @@ + @@ -89,6 +90,7 @@ + @@ -96,6 +98,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/ViewModels/ListContentPartsViewModel.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/ViewModels/ListContentPartsViewModel.cs new file mode 100644 index 000000000..309cf1c3e --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/ViewModels/ListContentPartsViewModel.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +using Orchard.ContentManagement.MetaData.Models; +using Orchard.Mvc.ViewModels; + +namespace Orchard.ContentTypes.ViewModels { + public class ListContentPartsViewModel : BaseViewModel { + public IEnumerable Parts { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/List.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/List.ascx index 362ac9697..f39880914 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/List.ascx +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/List.ascx @@ -1,11 +1,11 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> - -

- <%:Html.TitleForPage(T("Content Types").ToString())%>

+

<%:Html.TitleForPage(T("Content Types").ToString())%>

- <%: Html.ActionLink(T("Create new type").ToString(), "Create", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" })%>
+ <%:Html.ActionLink(T("Create new type").ToString(), "Create", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" }) %> + <%:Html.ActionLink(T("Content Parts").ToString(), "ListParts", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button" }) %> + <%:Html.UnorderedList( Model.Types, (t,i) => Html.DisplayFor(m => t), "contentItems" - ) %> + ) %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/ListParts.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/ListParts.ascx new file mode 100644 index 000000000..96da99815 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/Admin/ListParts.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +

<%:Html.TitleForPage(T("Content Types").ToString())%>

+ +
+ <%:Html.ActionLink(T("Create new part").ToString(), "CreatePart", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" }) %> +
+<%:Html.UnorderedList( + Model.Parts, + (t,i) => Html.DisplayFor(m => t), + "contentItems" + ) %> \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentPartDefinition.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentPartDefinition.ascx new file mode 100644 index 000000000..c785c1215 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentPartDefinition.ascx @@ -0,0 +1,9 @@ +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> +
+
+

<%:Model.Name%>

+
+ +
\ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentTypeDefinition.ascx b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentTypeDefinition.ascx index 355388283..4c00b5e85 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentTypeDefinition.ascx +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/ContentTypeDefinition.ascx @@ -1,5 +1,4 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import namespace="Orchard.ContentManagement.MetaData.Models" %> +<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %>

<%:Model.DisplayName%>

@@ -7,9 +6,6 @@
\ No newline at end of file