Added list of content parts

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-02 11:28:31 -07:00
parent 9fb7ccaa11
commit d2e93fd33b
7 changed files with 45 additions and 11 deletions

View File

@@ -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();

View File

@@ -77,6 +77,7 @@
<Compile Include="Services\ContentDefinitionService.cs" />
<Compile Include="Services\IContentDefinitionService.cs" />
<Compile Include="ViewModels\AddFieldViewModel.cs" />
<Compile Include="ViewModels\ListContentPartsViewModel.cs" />
<Compile Include="ViewModels\RemoveFieldViewModel.cs" />
<Compile Include="ViewModels\RemovePartViewModel.cs" />
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
@@ -89,6 +90,7 @@
<Content Include="Styles\admin.css" />
<Content Include="Views\Admin\AddFieldTo.ascx" />
<Content Include="Views\Admin\AddPartsTo.ascx" />
<Content Include="Views\Admin\ListParts.ascx" />
<Content Include="Views\Admin\RemoveFieldFrom.ascx" />
<Content Include="Views\Admin\RemovePartFrom.ascx" />
<Content Include="Views\Admin\Create.ascx" />
@@ -96,6 +98,7 @@
<Content Include="Views\Admin\Edit.ascx" />
<Content Include="Views\Admin\List.ascx" />
<Content Include="Views\DisplayTemplates\ContentTypeDefinition.ascx" />
<Content Include="Views\DisplayTemplates\ContentPartDefinition.ascx" />
<Content Include="Views\DisplayTemplates\Field.ascx" />
<Content Include="Views\DisplayTemplates\Fields.ascx" />
<Content Include="Views\DisplayTemplates\Settings.ascx" />

View File

@@ -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<ContentPartDefinition> Parts { get; set; }
}
}

View File

@@ -1,11 +1,11 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.ListContentTypesViewModel>" %>
<h1>
<%:Html.TitleForPage(T("Content Types").ToString())%></h1>
<h1><%:Html.TitleForPage(T("Content Types").ToString())%></h1>
<div class="manage">
<%: Html.ActionLink(T("Create new type").ToString(), "Create", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" })%></div>
<%: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" }) %>
</div>
<%:Html.UnorderedList(
Model.Types,
(t,i) => Html.DisplayFor(m => t),
"contentItems"
) %>
) %>

View File

@@ -0,0 +1,11 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.ListContentPartsViewModel>" %>
<h1><%:Html.TitleForPage(T("Content Types").ToString())%></h1>
<p class="breadcrumb"><%:Html.ActionLink(T("Content Types").Text, "index") %><%:T(" &#62; ") %><%:T("Content Parts") %></p>
<div class="manage">
<%:Html.ActionLink(T("Create new part").ToString(), "CreatePart", new{Controller="Admin",Area="Orchard.ContentTypes"}, new { @class = "button primaryAction" }) %>
</div>
<%:Html.UnorderedList(
Model.Parts,
(t,i) => Html.DisplayFor(m => t),
"contentItems"
) %>

View File

@@ -0,0 +1,9 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentManagement.MetaData.Models.ContentPartDefinition>" %>
<div class="summary">
<div class="properties">
<h3><%:Model.Name%></h3>
</div>
<div class="related">
<%:Html.ActionLink(T("Edit").ToString(), "EditPart", new {area = "Orchard.ContentTypes", id = Model.Name})%>
</div>
</div>

View File

@@ -1,5 +1,4 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentTypeDefinition>" %>
<%@ Import namespace="Orchard.ContentManagement.MetaData.Models" %>
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition>" %>
<div class="summary">
<div class="properties">
<h3><%:Model.DisplayName%></h3>
@@ -7,9 +6,6 @@
</div>
<div class="related">
<%:Html.ActionLink(T("List Items").ToString(), "List", new {area = "Contents", id = Model.Name})%><%:T(" | ")%>
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new {area = "Orchard.ContentTypes", id = Model.Name})%><%:T(" | ") %>
<% using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveType", new {area = "Orchard.ContentTypes", id = Model.Name}), FormMethod.Post, new { @class = "inline link" })) { %>
<button type="submit" class="linkButton" title="<%:T("Delete") %>"><%:T("[Delete]")%></button><%
} %>
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new {area = "Orchard.ContentTypes", id = Model.Name})%>
</div>
</div>