--HG--
branch : composition
This commit is contained in:
Louis DeJardin
2010-10-11 16:14:07 -07:00
33 changed files with 68 additions and 76 deletions

View File

@@ -41,7 +41,7 @@ namespace Orchard.Core.Common.DataMigrations {
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(BodyPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "5" }},
{"Default", new ContentLocation { Zone = "Primary", Position = "5" }},
}));
return 2;
}
@@ -50,7 +50,7 @@ namespace Orchard.Core.Common.DataMigrations {
ContentDefinitionManager.AlterPartDefinition(typeof(CommonPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "metadata", Position = "5" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "20" }},
{"Editor", new ContentLocation { Zone = "Primary", Position = "20" }},
}));
return 3;
}

View File

@@ -19,14 +19,14 @@ namespace Orchard.Core.Common.Drivers {
}
protected override DriverResult Display(ContentPart part, TextField field, string displayType) {
var location = field.GetLocation(displayType, "primary", "1");
var location = field.GetLocation(displayType, "Primary", "1");
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
.Location(location);
}
protected override DriverResult Editor(ContentPart part, TextField field) {
var location = field.GetLocation("Editor", "primary", "1");
var location = field.GetLocation("Editor", "Primary", "1");
return ContentFieldTemplate(field, TemplateName, GetPrefix(field, part))
.Location(location);

View File

@@ -1,6 +1,6 @@
<div class="sections">
<div class="primary">
@Display(Model.primary)
@Display(Model.Primary)
</div>
<div class="secondary">
@Display(Model.secondary)

View File

@@ -1,3 +1,3 @@
content item -> @Model.ContentItem.ContentType
@Display(Model.primary)
@Display(Model.Primary)

View File

@@ -15,5 +15,5 @@
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
<br />@Display(Model.meta)
</div>
<div class="primary">@Display(Model.primary)</div>
<div class="primary">@Display(Model.Primary)</div>
</div>

View File

@@ -3,6 +3,6 @@
@Display(Model.Header)
</header>
<section>
@Display(Model.primary)
@Display(Model.Primary)
</section>
</article>

View File

@@ -99,7 +99,7 @@ namespace Orchard.Core.ContentsLocation.Settings {
var viewModel = new LocationSettingsViewModel {
Definition = location,
Location = settings.Get(location.Name),
DefaultLocation = new ContentLocation { Zone = "primary", Position = "1" }
DefaultLocation = new ContentLocation { Zone = "Primary", Position = "1" }
};
yield return DefinitionTemplate(viewModel, templateName: "LocationSettings", prefix: location.Name);
}

View File

@@ -22,8 +22,8 @@ namespace Orchard.Core.Localization.DataMigrations {
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(LocalizationPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "5" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }},
{"Default", new ContentLocation { Zone = "Primary", Position = "5" }},
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }},
}));
return 2;
}

View File

@@ -39,7 +39,7 @@ namespace Orchard.Core.Navigation.DataMigrations {
public int UpdateFrom2() {
ContentDefinitionManager.AlterPartDefinition(typeof(MenuPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "9" }}
{"Editor", new ContentLocation { Zone = "Primary", Position = "9" }}
}));
return 3;
}

View File

@@ -24,7 +24,7 @@ namespace Orchard.Core.Routable {
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(RoutePart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "before.5" }}
{"Editor", new ContentLocation { Zone = "Primary", Position = "before.5" }}
} ));
return 2;

View File

@@ -2,7 +2,7 @@
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
@Display(Model.primary)
@Display(Model.Primary)
<fieldset>
<input class="button primaryAction" type="submit" value="@T("Save")" />
</fieldset>

View File

@@ -51,7 +51,7 @@ namespace Orchard.Blogs.Drivers {
.Select(bp => _contentManager.BuildDisplay(bp, "SummaryAdmin.BlogPost")));
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, BlogPosts: list);
blogPostList.Metadata.Type = "Parts_Blogs_BlogPost.List.Admin";
var contentShape = ContentShape(blogPostList).Location("primary");
var contentShape = ContentShape(blogPostList).Location("Primary");
driverResults.Add(contentShape);
}
else if (!displayType.Contains("Summary")) {
@@ -60,7 +60,7 @@ namespace Orchard.Blogs.Drivers {
.Select(bp => _contentManager.BuildDisplay(bp, "Summary.BlogPost")));
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, BlogPosts: list);
blogPostList.Metadata.Type = "Parts_Blogs_BlogPost.List";
var contentShape = ContentShape(blogPostList).Location("primary");
var contentShape = ContentShape(blogPostList).Location("Primary");
driverResults.Add(contentShape);
_feedManager.Register(part);

View File

@@ -51,7 +51,7 @@ namespace Orchard.Blogs {
public int UpdateFrom2() {
ContentDefinitionManager.AlterPartDefinition(typeof(BlogPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }}
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
}));
return 3;
}

View File

@@ -8,11 +8,6 @@ using Orchard.Security;
namespace Orchard.Blogs.Models {
public class BlogPostPart : ContentPart {
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
public string Title {
get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; }

View File

@@ -4,4 +4,4 @@
@Display(Model.manage)
<div class="manage"><a href="@Url.BlogPostCreate((BlogPart)Model.ContentItem.Get(typeof(BlogPart)))" class="add button primaryAction">@T("New Post")</a></div>
@Display(Model.metadata)
@Display(Model.primary)
@Display(Model.Primary)

View File

@@ -7,4 +7,4 @@
<h1>@Html.TitleForPage((string)Model.Title)</h1>
@Display(Model.manage)
@Display(Model.metadata)
@Display(Model.primary)
@Display(Model.Primary)

View File

@@ -1,3 +1,3 @@
<h1>@Html.TitleForPage((string)Model.Title)</h1>
@Display(Model.metadata)
@Display(Model.primary)
@Display(Model.Primary)

View File

@@ -1,4 +1,4 @@
@Html.AddTitleParts(Model.Title)
@Display(Model.primary)
@Display(Model.Primary)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!111 Content.Edit.Blog !!!!!!!!!!!!!!!!!!!!!!!!11
<fieldset><input class="button primaryAction" type="submit" value="@T("Add")" /></fieldset>

View File

@@ -5,7 +5,7 @@
}
<div class="sections">
<div class="primary">
@Display(Model.primary)
@Display(Model.Primary)
</div>
<div class="secondary">
@Display(Model.secondary)

View File

@@ -5,4 +5,4 @@
@using Orchard.Core.Common.ViewModels;
<h2>@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h2>
<div class="meta">@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T) | @Display(Model.meta)</div>
<div class="content">@Display(Model.primary)</div>
<div class="content">@Display(Model.Primary)</div>

View File

@@ -18,5 +18,5 @@
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
<br />@Display(Model.meta)
</div>
<div class="primary">@Display(Model.primary)</div>
<div class="primary">@Display(Model.Primary)</div>
</div>

View File

@@ -68,11 +68,11 @@ namespace Orchard.Comments {
public int UpdateFrom2() {
ContentDefinitionManager.AlterPartDefinition(typeof(CommentsPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "before.5" }},
{"Detail", new ContentLocation { Zone = "primary", Position = "after.5" }},
{"Default", new ContentLocation { Zone = "Primary", Position = "before.5" }},
{"Detail", new ContentLocation { Zone = "Primary", Position = "after.5" }},
{"SummaryAdmin", new ContentLocation { Zone = "meta", Position = null }},
{"Summary", new ContentLocation { Zone = "meta", Position = "5" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "10" }},
{"Editor", new ContentLocation { Zone = "Primary", Position = "10" }},
}));
ContentDefinitionManager.AlterPartDefinition(typeof(CommentsContainerPart).Name, cfg => cfg

View File

@@ -17,7 +17,6 @@ namespace Orchard.Roles.Models {
}
class SimulatedUser : ContentPart, IUser {
public int Id { get { return ContentItem.Id; } }
public string UserName { get { return null; } }
public string Email { get { return null; } }
}

View File

@@ -28,8 +28,8 @@ namespace Orchard.Tags {
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(TagsPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "49" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "9" }},
{"Default", new ContentLocation { Zone = "Primary", Position = "49" }},
{"Editor", new ContentLocation { Zone = "Primary", Position = "9" }},
}));
return 2;
}

View File

@@ -82,21 +82,21 @@ namespace Orchard.Widgets {
ContentDefinitionManager.AlterPartDefinition(typeof(LayerPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }}
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }}
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetBagPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation {Zone = "primary", Position = "5"}}
{"Editor", new ContentLocation {Zone = "Primary", Position = "5"}}
})
);
ContentDefinitionManager.AlterTypeDefinition("WidgetPage",

View File

@@ -5,14 +5,6 @@ using Orchard.ContentManagement;
namespace Orchard.Widgets.Models {
public class LayerPart : ContentPart<LayerPartRecord> {
/// <summary>
/// The layer's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
/// <summary>
/// The layer's name.
/// </summary>

View File

@@ -7,14 +7,6 @@ using Orchard.ContentManagement.Aspects;
namespace Orchard.Widgets.Models {
public class WidgetPart : ContentPart<WidgetPartRecord> {
/// <summary>
/// The widget's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
/// <summary>
/// The widget's title.
/// </summary>

View File

@@ -3,23 +3,23 @@
font-weight:bold;
}
.availableWidgets {
.widgets-availableWidgets {
float: left;
width: 35%;
}
.availableLayers {
.widgets-availableLayers {
float: left;
margin: 0 0 0 2em;
width: 45%;
}
.layerZones {
.widgets-layerZones {
float: left;
width: 75%;
}
.layerZones .zone {
.widgets-layerZones .widgets-zone {
font-weight:700;
background:#f5f5f5;
border: 1px solid #f1f1f1;
@@ -27,7 +27,7 @@
margin: 0 0 1em 0;
}
.layerZones .zoneWidget {
.widgets-layerZones .widgets-zoneWidget {
margin: 0 0 1em 0;
padding: 1em 2em 1em 3em;
background:#ffffff;
@@ -35,26 +35,26 @@
vertical-align: middle;
}
.layers {
.widgets-layers {
margin: 1em 0 0 0;
float: left;
}
.layers ul {
.widgets-layers ul {
background: #f5f5f5;
border: 1px solid #f1f1f1;
}
.layers .currentLayer {
.widgets-layers .widgets-currentLayer {
background: #c3d9ff;
}
.layers .editLayer img {
.widgets-layers .widgets-editLayer img {
float: right;
margin: 0 0 0 1em;
}
.layerZones ul li ul {
.widgets-layerZones ul li ul {
margin: 0;
padding: 0;
}

View File

@@ -10,9 +10,9 @@
<div class="manage">@Html.ActionLink(T("Add a layer").ToString(), "AddLayer", new { }, new { @class = "button primaryAction" })</div>
<div id="widgets" class="widgets">
<div id="widgets">
<div class="availableWidgets">
<div class="widgets-availableWidgets">
<h2>Available Widgets</h2>
<fieldset>
@@ -38,18 +38,18 @@
</fieldset>
</div>
<div class="availableLayers">
<div class="widgets-availableLayers">
<h2>Widget Layers</h2>
<fieldset>
<div class="layerZonesWidgets">
<ul class="layerZones">
<div>
<ul class="widgets-layerZones">
@foreach (string zone in Model.Zones) {
<li>
<div class="zone">@zone</div>
<div class="widgets-zone">@zone</div>
<ul>
@foreach (WidgetPart widget in Model.CurrentLayerWidgets.Where(widgetPart => widgetPart.Zone == zone).OrderBy(widgetPart => widgetPart.Position)) {
<li class="zoneWidget">
<li class="widgets-zoneWidget">
@if (widget.Position != "1") {
<input type="image" name="submit.MoveUp.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/moveup.gif")" alt="Move up" value="@widget.Id" />
}
@@ -65,18 +65,18 @@
</ul>
</div>
<div class="layers">
<div class="widgets-layers">
<ul>
@foreach (var layer in Model.Layers) {
if (layer.Id == Model.CurrentLayer.Id) {
<li class="currentLayer editLayer">
<li class="widgets-currentLayer widgets-editLayer">
@Html.ActionLink(@layer.Name, "Index", new { @layer.Id })
<a href="@Url.Action("EditLayer", new { @layer.Id })">
<img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" />
</a>
</li>
} else {
<li class="editLayer">
<li class="widgets-editLayer">
@Html.ActionLink(@layer.Name, "Index", new { @layer.Id })
<a href="@Url.Action("EditLayer", new { @layer.Id })">
<img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" />

View File

@@ -7,4 +7,4 @@
<h1>@Html.TitleForPage((string)Model.Title)</h1>
@Display(Model.manage)
@Display(Model.metadata)
@Display(Model.primary)
@Display(Model.Primary)

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.Utilities;
using Orchard.UI;
@@ -23,6 +24,14 @@ namespace Orchard.ContentManagement {
}
}
/// <summary>
/// The ContentItem's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
public ContentTypeDefinition TypeDefinition { get { return ContentItem.TypeDefinition; } }
public ContentTypePartDefinition TypePartDefinition { get; set; }
public ContentPartDefinition PartDefinition { get { return TypePartDefinition.PartDefinition; } }

View File

@@ -10,7 +10,7 @@ namespace Orchard.ContentManagement.Handlers {
public TemplateFilterForRecord(string prefix, string templateName) {
_prefix = prefix;
_templateName = templateName;
_location = "primary";
_location = "Primary";
_position = "5";
}

View File

@@ -3,5 +3,10 @@
namespace Orchard.ContentManagement {
public interface IContent {
ContentItem ContentItem { get; }
/// <summary>
/// The ContentItem's identifier.
/// </summary>
int Id { get; }
}
}