mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Committing changes on content Items_ name change
--HG-- branch : dev
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BasicShapeTemplateHarvesterTests {
|
public class BasicShapeTemplateHarvesterTests {
|
||||||
private static void VerifyShapeType(string givenSubPath, string givenFileName, string expectedShapeType) {
|
private static void VerifyShapeType(string givenSubPath, string givenFileName, string expectedShapeType) {
|
||||||
var harvester = new BasicShapeTemplateHarvester(Enumerable.Empty<IShapeTemplateViewEngine>());
|
var harvester = new BasicShapeTemplateHarvester();
|
||||||
var harvestShapeHits = harvester.HarvestShape(new HarvestShapeInfo { SubPath = givenSubPath, FileName = givenFileName });
|
var harvestShapeHits = harvester.HarvestShape(new HarvestShapeInfo { SubPath = givenSubPath, FileName = givenFileName });
|
||||||
Assert.That(harvestShapeHits.Count(), Is.EqualTo(1));
|
Assert.That(harvestShapeHits.Count(), Is.EqualTo(1));
|
||||||
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType));
|
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType));
|
||||||
@@ -31,38 +31,31 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DefaultItemsContentTemplate() {
|
public void DefaultItemsContentTemplate() {
|
||||||
VerifyShapeType("Views/Items", "Content", "Items_Content");
|
VerifyShapeType("Views/Items", "Content", "Content");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ImplicitSpecializationOfItemsContentTemplate() {
|
public void ImplicitSpecializationOfItemsContentTemplate() {
|
||||||
VerifyShapeType("Views/Items", "MyType", "Items_Content__MyType");
|
VerifyShapeType("Views/Items", "MyType", "MyType");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ExplicitSpecializationOfItemsContentTemplate() {
|
public void ExplicitSpecializationOfItemsContentTemplate() {
|
||||||
VerifyShapeType("Views/Items", "Content-MyType", "Items_Content__MyType");
|
VerifyShapeType("Views/Items", "Content-MyType", "Content__MyType");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ContentItemDisplayTypes() {
|
public void ContentItemDisplayTypes() {
|
||||||
VerifyShapeType("Views/Items", "Content", "Items_Content");
|
VerifyShapeType("Views/Items", "Content", "Content");
|
||||||
VerifyShapeType("Views/Items", "Content.Summary", "Items_Content_Summary");
|
VerifyShapeType("Views/Items", "Content.Summary", "Content_Summary");
|
||||||
VerifyShapeType("Views/Items", "Content.Edit", "Items_Content_Edit");
|
VerifyShapeType("Views/Items", "Content.Edit", "Content_Edit");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ExplicitSpecializationMixedWithDisplayTypes() {
|
public void ExplicitSpecializationMixedWithDisplayTypes() {
|
||||||
VerifyShapeType("Views/Items", "Content-MyType", "Items_Content__MyType");
|
VerifyShapeType("Views/Items", "Content-MyType", "Content__MyType");
|
||||||
VerifyShapeType("Views/Items", "Content-MyType.Summary", "Items_Content_Summary__MyType");
|
VerifyShapeType("Views/Items", "Content-MyType.Summary", "Content_Summary__MyType");
|
||||||
VerifyShapeType("Views/Items", "Content-MyType.Edit", "Items_Content_Edit__MyType");
|
VerifyShapeType("Views/Items", "Content-MyType.Edit", "Content_Edit__MyType");
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ImplicitSpecializationMixedWithDisplayTypes() {
|
|
||||||
VerifyShapeType("Views/Items", "MyType", "Items_Content__MyType");
|
|
||||||
VerifyShapeType("Views/Items", "MyType.Summary", "Items_Content_Summary__MyType");
|
|
||||||
VerifyShapeType("Views/Items", "MyType.Edit", "Items_Content_Edit__MyType");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@@ -4,27 +4,27 @@ using Orchard.DisplayManagement.Descriptors;
|
|||||||
namespace Orchard.Core.Contents {
|
namespace Orchard.Core.Contents {
|
||||||
public class Shapes : IShapeTableProvider {
|
public class Shapes : IShapeTableProvider {
|
||||||
public void Discover(ShapeTableBuilder builder) {
|
public void Discover(ShapeTableBuilder builder) {
|
||||||
builder.Describe("Items_Content")
|
builder.Describe("Content")
|
||||||
.OnDisplaying(displaying => {
|
.OnDisplaying(displaying => {
|
||||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||||
if (contentItem != null) {
|
if (contentItem != null) {
|
||||||
//Content-BlogPost
|
//Content-BlogPost
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Content__" + contentItem.ContentType);
|
displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.ContentType);
|
||||||
//Content-42
|
//Content-42
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Content__" + contentItem.Id);
|
displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.Id);
|
||||||
//Content.Summary
|
//Content.Summary
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Content_" + displaying.ShapeMetadata.DisplayType);
|
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);
|
||||||
//Content.Summary-Page
|
//Content.Summary-Page
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);
|
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.Describe("Items_Content_Edit")
|
builder.Describe("Content_Edit")
|
||||||
.OnDisplaying(displaying => {
|
.OnDisplaying(displaying => {
|
||||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||||
if (contentItem != null) {
|
if (contentItem != null) {
|
||||||
//Content.Editor-Page
|
//Content.Editor-Page
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Content_Edit__" + contentItem.ContentType);
|
displaying.ShapeMetadata.Alternates.Add("Content_Edit__" + contentItem.ContentType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ namespace Orchard.Blogs {
|
|||||||
[OrchardFeature("Remote Blog Publishing")]
|
[OrchardFeature("Remote Blog Publishing")]
|
||||||
public class RemoteBlogPublishingShapes : IShapeTableProvider {
|
public class RemoteBlogPublishingShapes : IShapeTableProvider {
|
||||||
public void Discover(ShapeTableBuilder builder) {
|
public void Discover(ShapeTableBuilder builder) {
|
||||||
builder.Describe("Items_Content__Blog")
|
builder.Describe("Content__Blog")
|
||||||
.OnDisplaying(displaying => {
|
.OnDisplaying(displaying => {
|
||||||
if (displaying.ShapeMetadata.DisplayType == "Detail") {
|
if (displaying.ShapeMetadata.DisplayType == "Detail") {
|
||||||
displaying.ShapeMetadata.Wrappers.Add("RemoteBlogPublishing");
|
displaying.ShapeMetadata.Wrappers.Add("RemoteBlogPublishing");
|
||||||
|
@@ -116,12 +116,12 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Views\Admin\Index.cshtml" />
|
<None Include="Views\Admin\Index.cshtml" />
|
||||||
<Content Include="Views\Items\Widget.Editor.cshtml" />
|
<None Include="Views\Items\Widget.cshtml" />
|
||||||
<None Include="Views\Widget.Manage.cshtml" />
|
<None Include="Views\Items\Widget.Edit.cshtml" />
|
||||||
|
<None Include="Views\Widget.ControlWrapper.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||||
<Content Include="Views\Items\Widget.cshtml" />
|
|
||||||
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
|
||||||
<None Include="Views\Widget.Wrapper.cshtml" />
|
<None Include="Views\Widget.Wrapper.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@@ -5,7 +5,7 @@ using Orchard.Widgets.Models;
|
|||||||
namespace Orchard.Widgets {
|
namespace Orchard.Widgets {
|
||||||
public class Shapes : IShapeTableProvider {
|
public class Shapes : IShapeTableProvider {
|
||||||
public void Discover(ShapeTableBuilder builder) {
|
public void Discover(ShapeTableBuilder builder) {
|
||||||
builder.Describe("Items_Widget")
|
builder.Describe("Widget")
|
||||||
.Configure(descriptor => {
|
.Configure(descriptor => {
|
||||||
// todo: have "alternates" for chrome
|
// todo: have "alternates" for chrome
|
||||||
//todo: (heskew) something...this still doesn't feel right
|
//todo: (heskew) something...this still doesn't feel right
|
||||||
@@ -20,8 +20,8 @@ namespace Orchard.Widgets {
|
|||||||
ContentItem contentItem = displaying.Shape.ContentItem;
|
ContentItem contentItem = displaying.Shape.ContentItem;
|
||||||
if (contentItem != null) {
|
if (contentItem != null) {
|
||||||
var zoneName = contentItem.As<WidgetPart>().Zone;
|
var zoneName = contentItem.As<WidgetPart>().Zone;
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + contentItem.ContentType);
|
displaying.ShapeMetadata.Alternates.Add("Widget__" + contentItem.ContentType);
|
||||||
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName);
|
displaying.ShapeMetadata.Alternates.Add("Widget__" + zoneName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
<div class="sections">
|
|
||||||
<div class="primary">
|
|
||||||
@Display(Model.Primary)
|
|
||||||
</div>
|
|
||||||
<div class="secondary">
|
|
||||||
@Display(Model.secondary)
|
|
||||||
<fieldset>
|
|
||||||
<input class="button primaryAction" type="submit" name="submit.Save" value="@T("Save")"/>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,2 +0,0 @@
|
|||||||
@Display(Model.Header)
|
|
||||||
@Display(Model.Content)
|
|
@@ -61,7 +61,7 @@ namespace Orchard.ContentManagement {
|
|||||||
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
||||||
stereotype = "Content";
|
stereotype = "Content";
|
||||||
|
|
||||||
var actualShapeType = "Items_" + stereotype;
|
var actualShapeType = stereotype;
|
||||||
var actualDisplayType = string.IsNullOrWhiteSpace(displayType) ? "Detail" : displayType;
|
var actualDisplayType = string.IsNullOrWhiteSpace(displayType) ? "Detail" : displayType;
|
||||||
|
|
||||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||||
@@ -81,7 +81,7 @@ namespace Orchard.ContentManagement {
|
|||||||
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
||||||
stereotype = "Content";
|
stereotype = "Content";
|
||||||
|
|
||||||
var actualShapeType = "Items_" + stereotype + "_Edit";
|
var actualShapeType = stereotype + "_Edit";
|
||||||
|
|
||||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||||
itemShape.ContentItem = content.ContentItem;
|
itemShape.ContentItem = content.ContentItem;
|
||||||
@@ -99,7 +99,7 @@ namespace Orchard.ContentManagement {
|
|||||||
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
|
||||||
stereotype = "Content";
|
stereotype = "Content";
|
||||||
|
|
||||||
var actualShapeType = "Items_" + stereotype + "_Edit";
|
var actualShapeType = stereotype + "_Edit";
|
||||||
|
|
||||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||||
itemShape.ContentItem = content.ContentItem;
|
itemShape.ContentItem = content.ContentItem;
|
||||||
|
@@ -15,11 +15,6 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class BasicShapeTemplateHarvester : IShapeTemplateHarvester {
|
public class BasicShapeTemplateHarvester : IShapeTemplateHarvester {
|
||||||
private readonly IEnumerable<IShapeTemplateViewEngine> _shapeTemplateViewEngines;
|
|
||||||
|
|
||||||
public BasicShapeTemplateHarvester(IEnumerable<IShapeTemplateViewEngine> shapeTemplateViewEngines) {
|
|
||||||
_shapeTemplateViewEngines = shapeTemplateViewEngines;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> SubPaths() {
|
public IEnumerable<string> SubPaths() {
|
||||||
return new[] { "Views", "Views/Items", "Views/Parts", "Views/Fields" };
|
return new[] { "Views", "Views/Items", "Views/Parts", "Views/Fields" };
|
||||||
@@ -43,14 +38,10 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
|
|||||||
|
|
||||||
static string Adjust(string subPath, string fileName, string displayType) {
|
static string Adjust(string subPath, string fileName, string displayType) {
|
||||||
var leader = "";
|
var leader = "";
|
||||||
if (subPath.StartsWith("Views/")) {
|
if (subPath.StartsWith("Views/") && subPath != "Views/Items") {
|
||||||
leader = subPath.Substring("Views/".Length) + "_";
|
leader = subPath.Substring("Views/".Length) + "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leader == "Items_" && !fileName.StartsWith("Content")) {
|
|
||||||
leader = "Items_Content__";
|
|
||||||
}
|
|
||||||
|
|
||||||
// canonical shape type names must not have - or . to be compatible
|
// canonical shape type names must not have - or . to be compatible
|
||||||
// with display and shape api calls)))
|
// with display and shape api calls)))
|
||||||
var shapeType = leader + fileName.Replace("--", "__").Replace("-", "__").Replace('.', '_');
|
var shapeType = leader + fileName.Replace("--", "__").Replace("-", "__").Replace('.', '_');
|
||||||
|
Reference in New Issue
Block a user