mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Added list of content parts
--HG-- branch : dev
This commit is contained in:
@@ -282,6 +282,12 @@ namespace Orchard.ContentTypes.Controllers {
|
|||||||
|
|
||||||
#region Parts
|
#region Parts
|
||||||
|
|
||||||
|
public ActionResult ListParts() {
|
||||||
|
return View(new ListContentPartsViewModel {
|
||||||
|
Parts = _contentDefinitionService.GetPartDefinitions()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult EditPart(string id) {
|
public ActionResult EditPart(string id) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
@@ -77,6 +77,7 @@
|
|||||||
<Compile Include="Services\ContentDefinitionService.cs" />
|
<Compile Include="Services\ContentDefinitionService.cs" />
|
||||||
<Compile Include="Services\IContentDefinitionService.cs" />
|
<Compile Include="Services\IContentDefinitionService.cs" />
|
||||||
<Compile Include="ViewModels\AddFieldViewModel.cs" />
|
<Compile Include="ViewModels\AddFieldViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ListContentPartsViewModel.cs" />
|
||||||
<Compile Include="ViewModels\RemoveFieldViewModel.cs" />
|
<Compile Include="ViewModels\RemoveFieldViewModel.cs" />
|
||||||
<Compile Include="ViewModels\RemovePartViewModel.cs" />
|
<Compile Include="ViewModels\RemovePartViewModel.cs" />
|
||||||
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
|
<Compile Include="ViewModels\CreateTypeViewModel.cs" />
|
||||||
@@ -89,6 +90,7 @@
|
|||||||
<Content Include="Styles\admin.css" />
|
<Content Include="Styles\admin.css" />
|
||||||
<Content Include="Views\Admin\AddFieldTo.ascx" />
|
<Content Include="Views\Admin\AddFieldTo.ascx" />
|
||||||
<Content Include="Views\Admin\AddPartsTo.ascx" />
|
<Content Include="Views\Admin\AddPartsTo.ascx" />
|
||||||
|
<Content Include="Views\Admin\ListParts.ascx" />
|
||||||
<Content Include="Views\Admin\RemoveFieldFrom.ascx" />
|
<Content Include="Views\Admin\RemoveFieldFrom.ascx" />
|
||||||
<Content Include="Views\Admin\RemovePartFrom.ascx" />
|
<Content Include="Views\Admin\RemovePartFrom.ascx" />
|
||||||
<Content Include="Views\Admin\Create.ascx" />
|
<Content Include="Views\Admin\Create.ascx" />
|
||||||
@@ -96,6 +98,7 @@
|
|||||||
<Content Include="Views\Admin\Edit.ascx" />
|
<Content Include="Views\Admin\Edit.ascx" />
|
||||||
<Content Include="Views\Admin\List.ascx" />
|
<Content Include="Views\Admin\List.ascx" />
|
||||||
<Content Include="Views\DisplayTemplates\ContentTypeDefinition.ascx" />
|
<Content Include="Views\DisplayTemplates\ContentTypeDefinition.ascx" />
|
||||||
|
<Content Include="Views\DisplayTemplates\ContentPartDefinition.ascx" />
|
||||||
<Content Include="Views\DisplayTemplates\Field.ascx" />
|
<Content Include="Views\DisplayTemplates\Field.ascx" />
|
||||||
<Content Include="Views\DisplayTemplates\Fields.ascx" />
|
<Content Include="Views\DisplayTemplates\Fields.ascx" />
|
||||||
<Content Include="Views\DisplayTemplates\Settings.ascx" />
|
<Content Include="Views\DisplayTemplates\Settings.ascx" />
|
||||||
|
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,9 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.ListContentTypesViewModel>" %>
|
<%@ 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">
|
<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(
|
<%:Html.UnorderedList(
|
||||||
Model.Types,
|
Model.Types,
|
||||||
(t,i) => Html.DisplayFor(m => t),
|
(t,i) => Html.DisplayFor(m => t),
|
||||||
|
@@ -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(" > ") %><%: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"
|
||||||
|
) %>
|
@@ -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>
|
@@ -1,5 +1,4 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentTypeDefinition>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition>" %>
|
||||||
<%@ Import namespace="Orchard.ContentManagement.MetaData.Models" %>
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<div class="properties">
|
<div class="properties">
|
||||||
<h3><%:Model.DisplayName%></h3>
|
<h3><%:Model.DisplayName%></h3>
|
||||||
@@ -7,9 +6,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
<%:Html.ActionLink(T("List Items").ToString(), "List", new {area = "Contents", id = Model.Name})%><%:T(" | ")%>
|
<%: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(" | ") %>
|
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new {area = "Orchard.ContentTypes", id = Model.Name})%>
|
||||||
<% 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><%
|
|
||||||
} %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Reference in New Issue
Block a user