Some progress on converting Core.Contents

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-09-21 16:09:31 -07:00
parent 9c3dd779df
commit 17eade34db
11 changed files with 33 additions and 42 deletions

View File

@@ -198,7 +198,13 @@ namespace Orchard.Core.Contents.Controllers {
}
ActionResult CreatableTypeList() {
return View(Shape.Model(Types: GetCreatableTypes()));
var list = Shape.List();
list.AddRange(GetCreatableTypes());
var viewModel = Shape.ViewModel()
.ContentTypes(list);
return View("CreatableTypeList", viewModel);
}
public ActionResult Create(string id) {

View File

@@ -1,7 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentTypesViewModel>" %>
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
<h1><%:Html.TitleForPage(T("Create New Content").ToString())%></h1>
<%:Html.UnorderedList(
Model.Types,
(ctd, i) => MvcHtmlString.Create(string.Format("<p>{0}</p>", Html.ActionLink(ctd.DisplayName, "Create", new { Area = "Contents", Id = ctd.Name }))),
"contentTypes")%>

View File

@@ -0,0 +1,4 @@
<h1>@Html.TitleForPage(T("Create New Content").ToString())</h1>
@foreach (var type in Model.ContentTypes) {
<p>@Html.ActionLink((string)type.DisplayName, "Create", new { Area = "Contents", Id = (string)type.Name })</p>
}

View File

@@ -1,4 +1,9 @@
@{
var typeDisplayName = Model.ContentItem.TypeDefinition.DisplayName;
var pageTitle = T("Create {0}", typeDisplayName);
}
<h1>@Html.TitleForPage((string)pageTitle.Text)</h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
@Display(Model)
}
}

View File

@@ -5,9 +5,8 @@
pageTitle = T("Edit {0}", typeDisplayName);
}
}
<h1>@Html.TitleForPage(pageTitle)</h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
@Display(Model)
}
}

View File

@@ -1,8 +1,16 @@
@using Orchard.Core.Contents.ViewModels
<h1>@//Html.TitleForPage((string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Manage Content") : T("Manage {0} Content", Model.TypeDisplayName)).ToString())
</h1>
@{
var typeDisplayName = Model.TypeDisplayName;
var pageTitle = T("Manage Content");
var createLinkText = T("Create New Content");
if (!string.IsNullOrWhiteSpace(typeDisplayName)) {
pageTitle = T("Manage {0} Content", typeDisplayName);
createLinkText = T("Create New {0}", typeDisplayName);
}
}
<h1>@Html.TitleForPage(pageTitle)</h1>
<div class="manage">
@Html.ActionLink((string)(!string.IsNullOrEmpty((string)Model.TypeDisplayName) ? T("Create New {0}", Model.TypeDisplayName).Text : T("Create New Content").Text), "Create", null, new { @class = "button primaryAction" })
@Html.ActionLink(createLinkText.Text, "Create", new { Area = "Contents", Id = (string)Model.Options.SelectedFilter }, new { @class = "button primaryAction" })
</div>
@using (Html.BeginFormAntiForgeryPost()) {
<fieldset class="bulk-actions">
@@ -20,7 +28,7 @@
<select id="filterResults" name="Options.SelectedFilter">
@Html.SelectOption((string)Model.Options.SelectedFilter, "", T("any (show all)").ToString())
@foreach(var filterOption in Model.Options.FilterOptions) {
@Html.SelectOption((String)Model.Options.SelectedFilter, (string)filterOption.Key, (string)filterOption.Value)
@Html.SelectOption((string)Model.Options.SelectedFilter, (string)filterOption.Key, (string)filterOption.Value)
}
</select>
<label for="orderResults" class="bulk-order">@T("Ordered by")</label>

View File

@@ -1,11 +0,0 @@
@{
//home page content - should fall back to items/content so this template is optional (e.g. in a theme)
}
<article>
<header>
@Display(Model.Header)
</header>
<section>
@Display(Model.primary)
</section>
</article>

View File

@@ -4,7 +4,6 @@
ContentItem contentItem = Model.ContentItem;
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
}
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
<div class="properties">
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
@@ -17,4 +16,4 @@
<br />@Display(Model.meta)
</div>
<div class="primary">@Display(Model.primary)</div>
</div>
</div>

View File

@@ -279,7 +279,7 @@
<None Include="Common\Views\EditorTemplates\Parts\Common.Container.cshtml" />
<None Include="Common\Views\EditorTemplates\PlainTextEditor.cshtml" />
<Content Include="Contents\Module.txt" />
<Content Include="Contents\Views\Admin\CreatableTypeList.ascx" />
<None Include="Contents\Views\Admin\CreatableTypeList.cshtml" />
<Content Include="Localization\Styles\admin.css" />
<Content Include="Localization\Styles\base.css" />
<None Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.cshtml" />
@@ -288,7 +288,6 @@
<Content Include="PublishLater\Styles\datetime.css" />
<None Include="PublishLater\Views\EditorTemplates\Parts\PublishLater.cshtml" />
<Content Include="Reports\Module.txt" />
<None Include="Contents\Views\Items\Content-HomePage.cshtml" />
<None Include="Reports\Views\Admin\Display.cshtml" />
<None Include="Reports\Views\Admin\Index.cshtml" />
<Content Include="Localization\Module.txt" />

View File

@@ -62,6 +62,7 @@ namespace Orchard.Core.Routable.Handlers {
public override void GetContentItemMetadata(GetContentItemMetadataContext context) {
var routable = context.ContentItem.As<RoutePart>();
if (routable != null) {
context.Metadata.DisplayText = routable.Title;
context.Metadata.DisplayRouteValues = new RouteValueDictionary {
{"Area", "Routable"},
{"Controller", "Item"},

View File

@@ -1,12 +0,0 @@
--- Menu.cshtml
+++ Menu.cshtml
@@ -1,3 +1,8 @@
-<ul id="Menu-@Model.MenuName" class="Menu Menu-@Model.MenuName">
+@using Orchard.Core.Shapes.Extensions
+@{
+var menuClasses = "menu menu-" + Model.MenuName.HtmlClassify();
+var attributes = new RouteValueDictionary(Model.Attributes).ToHtmlStringWith(new {@class = menuClasses});
+}
+<ul id="Menu-@Model.MenuName" @attributes>
@foreach(var item in Model) {@Display(item);}
</ul><!-- /Menu-@Model.MenuName -->