--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-10-15 14:56:44 -07:00
39 changed files with 405 additions and 170 deletions

View File

@@ -6,7 +6,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
[TestFixture]
public class BasicShapeTemplateHarvesterTests {
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 });
Assert.That(harvestShapeHits.Count(), Is.EqualTo(1));
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType));
@@ -31,38 +31,31 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
[Test]
public void DefaultItemsContentTemplate() {
VerifyShapeType("Views/Items", "Content", "Items_Content");
VerifyShapeType("Views/Items", "Content", "Content");
}
[Test]
public void ImplicitSpecializationOfItemsContentTemplate() {
VerifyShapeType("Views/Items", "MyType", "Items_Content__MyType");
VerifyShapeType("Views/Items", "MyType", "MyType");
}
[Test]
public void ExplicitSpecializationOfItemsContentTemplate() {
VerifyShapeType("Views/Items", "Content-MyType", "Items_Content__MyType");
VerifyShapeType("Views/Items", "Content-MyType", "Content__MyType");
}
[Test]
public void ContentItemDisplayTypes() {
VerifyShapeType("Views/Items", "Content", "Items_Content");
VerifyShapeType("Views/Items", "Content.Summary", "Items_Content_Summary");
VerifyShapeType("Views/Items", "Content.Edit", "Items_Content_Edit");
VerifyShapeType("Views/Items", "Content", "Content");
VerifyShapeType("Views/Items", "Content.Summary", "Content_Summary");
VerifyShapeType("Views/Items", "Content.Edit", "Content_Edit");
}
[Test]
public void ExplicitSpecializationMixedWithDisplayTypes() {
VerifyShapeType("Views/Items", "Content-MyType", "Items_Content__MyType");
VerifyShapeType("Views/Items", "Content-MyType.Summary", "Items_Content_Summary__MyType");
VerifyShapeType("Views/Items", "Content-MyType.Edit", "Items_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");
VerifyShapeType("Views/Items", "Content-MyType", "Content__MyType");
VerifyShapeType("Views/Items", "Content-MyType.Summary", "Content_Summary__MyType");
VerifyShapeType("Views/Items", "Content-MyType.Edit", "Content_Edit__MyType");
}
[Test]

View File

@@ -55,7 +55,7 @@ namespace Orchard.Core.Common.Drivers {
protected override DriverResult Editor(BodyPart part, dynamic shapeHelper) {
var model = BuildEditorViewModel(part);
return ContentShape("Parts_Common_Body_Editor",
return ContentShape("Parts_Common_Body_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}
@@ -63,7 +63,7 @@ namespace Orchard.Core.Common.Drivers {
var model = BuildEditorViewModel(part);
updater.TryUpdateModel(model, Prefix, null, null);
return ContentShape("Parts_Common_Body_Editor",
return ContentShape("Parts_Common_Body_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}

View File

@@ -2,7 +2,7 @@
<Place Parts_Common_Metadata="-"/>
<Place Parts_Common_Metadata_Summary="-"/>
<Place Parts_Common_Metadata_SummaryAdmin="-"/>
<Place Parts_Common_Body_Editor="Primary:2"/>
<Place Parts_Common_Body_Edit="Primary:2"/>
<!-- show summary for all DisplayType by default -->
<Place Parts_Common_Body_Summary="Content:5"/>
<Match DisplayType="Detail">

View File

@@ -4,27 +4,27 @@ using Orchard.DisplayManagement.Descriptors;
namespace Orchard.Core.Contents {
public class Shapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Items_Content")
builder.Describe("Content")
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
//Content-BlogPost
displaying.ShapeMetadata.Alternates.Add("Items_Content__" + contentItem.ContentType);
displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.ContentType);
//Content-42
displaying.ShapeMetadata.Alternates.Add("Items_Content__" + contentItem.Id);
displaying.ShapeMetadata.Alternates.Add("Content__" + contentItem.Id);
//Content.Summary
displaying.ShapeMetadata.Alternates.Add("Items_Content_" + displaying.ShapeMetadata.DisplayType);
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);
//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_Editor")
builder.Describe("Content_Edit")
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
//Content.Editor-Page
displaying.ShapeMetadata.Alternates.Add("Items_Content_Editor__" + contentItem.ContentType);
displaying.ShapeMetadata.Alternates.Add("Content_Edit__" + contentItem.ContentType);
}
});
}

View File

@@ -0,0 +1,11 @@
<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>

View File

@@ -381,7 +381,7 @@
<Content Include="ContentsLocation\Views\Web.config" />
<Content Include="Messaging\Views\Web.config" />
<Content Include="Contents\Views\Items\Content.cshtml" />
<Content Include="Contents\Views\Items\Content.Editor.cshtml" />
<Content Include="Contents\Views\Items\Content.Edit.cshtml" />
<Content Include="Contents\Views\Items\Content.Summary.cshtml" />
<Content Include="Contents\Views\Items\Content.SummaryAdmin.cshtml" />
<Content Include="Shapes\Views\Document.cshtml" />

View File

@@ -43,7 +43,7 @@ namespace Orchard.Core.PublishLater.Drivers {
protected override DriverResult Editor(PublishLaterPart part, dynamic shapeHelper) {
var model = BuildEditorViewModel(part);
return ContentShape("Parts_PublishLater_Editor",
return ContentShape("Parts_PublishLater_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}
protected override DriverResult Editor(PublishLaterPart part, IUpdateModel updater, dynamic shapeHelper) {
@@ -65,7 +65,7 @@ namespace Orchard.Core.PublishLater.Drivers {
//Services.Notifier.Information(T("{0} draft has been saved!", model.ContentItem.TypeDefinition.DisplayName));
break;
}
return ContentShape("Parts_PublishLater_Editor",
return ContentShape("Parts_PublishLater_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}

View File

@@ -2,7 +2,7 @@
<Place Parts_PublishLater_Metadata="-"/>
<Place Parts_PublishLater_Metadata_Summary="-"/>
<Place Parts_PublishLater_Metadata_SummaryAdmin="-"/>
<Place Parts_PublishLater_Editor="Secondary:1"/>
<Place Parts_PublishLater_Edit="Secondary:1"/>
<Match DisplayType="Detail">
<Place Parts_PublishLater_Metadata="Meta:1"/>
</Match>

View File

@@ -6,7 +6,7 @@ using System.Xml.Linq;
using Orchard.Blogs.Models;
using Orchard.Blogs.Routing;
using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels;
using Orchard.ContentManagement;
using Orchard.DisplayManagement;
using Orchard.Logging;
using Orchard.Themes;
@@ -53,25 +53,27 @@ namespace Orchard.Blogs.Controllers {
if (correctedSlug == null)
return HttpNotFound();
BlogPart blog = _blogService.Get(correctedSlug);
if (blog == null)
var blogPart = _blogService.Get(correctedSlug);
if (blogPart == null)
return HttpNotFound();
var blogPosts = _blogPostService.Get(blog, (page - 1)*pageSize, pageSize).Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
var blogPosts = _blogPostService.Get(blogPart, (page - 1) * pageSize, pageSize)
.Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
blogPart.As<BlogPagerPart>().Page = page;
blogPart.As<BlogPagerPart>().PageSize = pageSize;
blogPart.As<BlogPagerPart>().BlogSlug = correctedSlug;
blogPart.As<BlogPagerPart>().ThereIsANextPage = _blogPostService.Get(blogPart, (page) * pageSize, pageSize).Any();
var blog = _services.ContentManager.BuildDisplay(blogPart);
var list = Shape.List();
list.AddRange(blogPosts);
var blogShape = _services.ContentManager.BuildDisplay(blog);
var model = new DisplayBlogViewModel {
Blog = blogShape,
BlogPostList = list,
Page = page,
PageSize = pageSize
};
return View(model);
blog.ContentItem = blogPart;
blog.Content.Add(Shape.Parts_Blogs_BlogPost_List(ContentItems: list), "5");
return View("Display", blog);
}
public ActionResult LiveWriterManifest(string blogSlug) {

View File

@@ -1,6 +1,5 @@
using Orchard.Blogs.Models;
using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
@@ -16,16 +15,17 @@ namespace Orchard.Blogs.Drivers {
}
protected override DriverResult Display(BlogArchivesPart part, string displayType, dynamic shapeHelper) {
BlogPart blog = null;
if (!string.IsNullOrWhiteSpace(part.ForBlog))
blog = _blogService.Get(part.ForBlog);
return ContentShape("Parts_Blogs_BlogArchives",
() => {
BlogPart blog = null;
if (!string.IsNullOrWhiteSpace(part.ForBlog))
blog = _blogService.Get(part.ForBlog);
if ( blog != null ) {
var model = new BlogPostArchiveViewModel {BlogPart = blog, Archives = _blogPostService.GetArchives(blog)};
return ContentPartTemplate(model, "Parts/Blogs.BlogArchives");
}
if (blog == null)
return null;
return null;
return shapeHelper.Parts_Blogs_BlogArchives(ContentItem: part, Blog: blog, Archives: _blogPostService.GetArchives(blog));
}).Location("Content");
}
protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) {

View File

@@ -0,0 +1,11 @@
using Orchard.Blogs.Models;
using Orchard.ContentManagement.Drivers;
namespace Orchard.Blogs.Drivers {
public class BlogPagerPartDriver : ContentPartDriver<BlogPagerPart> {
protected override DriverResult Display(BlogPagerPart part, string displayType, dynamic shapeHelper) {
return ContentShape("Parts_Blogs_Blog_Pager",
() => shapeHelper.Parts_Blogs_Blog_Pager(ContentPart: part, Page: part.Page, PageSize: part.PageSize, BlogSlug: part.BlogSlug, ThereIsANextPage: part.ThereIsANextPage));
}
}
}

View File

@@ -38,13 +38,15 @@ namespace Orchard.Blogs.Drivers {
() => shapeHelper.Parts_Blogs_Blog_Manage(ContentPart: part)),
ContentShape("Parts_Blogs_Blog_Description",
() => shapeHelper.Parts_Blogs_Blog_Description(ContentPart: part, Description: part.Description)),
// todo: (heskew) implement a paging solution that doesn't require blog posts to be tied to the blog within the controller
ContentShape("Parts_Blogs_BlogPost_List",
() => {
_feedManager.Register(part);
var list = shapeHelper.List();
list.AddRange(_blogPostService.Get(part)
.Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
return shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
return null;
// var list = shapeHelper.List();
// list.AddRange(_blogPostService.Get(part)
// .Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
// return shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
}),
ContentShape("Parts_Blogs_BlogPost_List_Admin",
() => {

View File

@@ -18,7 +18,7 @@ namespace Orchard.Blogs.Drivers {
}
protected override DriverResult Display(RecentBlogPostsPart part, string displayType, dynamic shapeHelper) {
IEnumerable<BlogPostPart> blogPosts = null;
IEnumerable<BlogPostPart> blogPosts;
BlogPart blog = null;
if (!string.IsNullOrWhiteSpace(part.ForBlog))
@@ -32,7 +32,6 @@ namespace Orchard.Blogs.Drivers {
.Select(ci => ci.As<BlogPostPart>());
}
else {
var blogs = _blogService.Get().ToList();
blogPosts = _contentManager.Query(VersionOptions.Published, "BlogPost")
.Join<CommonPartRecord>()
.OrderByDescending(cr => cr.CreatedUtc)
@@ -41,12 +40,11 @@ namespace Orchard.Blogs.Drivers {
}
var list = shapeHelper.List();
list.AddRange(blogPosts.Select(bp => _contentManager.BuildDisplay(bp, "Summary.BlogPost")));
list.AddRange(blogPosts.Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, BlogPosts: list);
blogPostList.Metadata.Type = "Parts_Blogs_BlogPost.List";
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
return ContentShape(blogPostList).Location("Primary");
return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part, ContentItems: blogPostList));
}
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {

View File

@@ -89,5 +89,11 @@ namespace Orchard.Blogs {
return 5;
}
public int UpdateFrom5() {
ContentDefinitionManager.AlterTypeDefinition("Blog",
cfg => cfg.WithPart("BlogPagerPart"));
return 6;
}
}
}

View File

@@ -0,0 +1,10 @@
using Orchard.ContentManagement;
namespace Orchard.Blogs.Models {
public class BlogPagerPart : ContentPart {
public int Page { get; set; }
public int PageSize { get; set; }
public string BlogSlug { get; set; }
public bool ThereIsANextPage { get; set; }
}
}

View File

@@ -68,11 +68,13 @@
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Drivers\BlogArchivesPartDriver.cs" />
<Compile Include="Drivers\BlogPagerPartDriver.cs" />
<Compile Include="Drivers\RecentBlogPostsPartDriver.cs" />
<Compile Include="Handlers\BlogArchivesPartHandler.cs" />
<Compile Include="Handlers\RecentBlogPostsPartHandler.cs" />
<Compile Include="Models\BlogArchivesPart.cs" />
<Compile Include="Models\BlogArchivesPartRecord.cs" />
<Compile Include="Models\BlogPagerPart.cs" />
<Compile Include="Models\RecentBlogPostsPart.cs" />
<Compile Include="Models\RecentBlogPostsPartRecord.cs" />
<Compile Include="ResourceManifest.cs" />
@@ -107,8 +109,7 @@
<Compile Include="Services\IBlogService.cs" />
<Compile Include="Services\XmlRpcHandler.cs" />
<Compile Include="RemoteBlogPublishingShapes.cs" />
<Compile Include="ViewModels\BlogPostArchiveViewModel.cs" />
<Compile Include="ViewModels\DisplayBlogViewModel.cs" />
<Compile Include="Shapes.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\Admin\images\draft.gif" />
@@ -161,7 +162,7 @@
<SubType>Designer</SubType>
</None>
<Content Include="Views\RemoteBlogPublishing.cshtml" />
<None Include="Views\DisplayTemplates\Parts\Blogs.BlogArchives.cshtml" />
<None Include="Views\Parts\Blogs.BlogArchives.cshtml" />
<None Include="Views\EditorTemplates\Parts\Blogs.RecentBlogPosts.cshtml" />
<None Include="Views\EditorTemplates\Parts\Blogs.BlogArchives.cshtml" />
<None Include="Views\Items\Blog.DetailAdmin.cshtml" />
@@ -169,6 +170,8 @@
<None Include="Views\Items\BlogPost.Editor.cshtml" />
<None Include="Views\Items\BlogPost.SummaryAdmin.cshtml" />
<None Include="Views\Parts\Blogs.BlogPost.List.cshtml" />
<None Include="Views\Parts\Blogs.Blog.Pager.cshtml" />
<None Include="Views\Parts\Blogs.RecentBlogPosts.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -1,13 +1,23 @@
<Placement>
<Place Parts_Blogs_Blog_Manage="-"/>
<Place Parts_Blogs_Blog_Description="-"/>
<Place Parts_Blogs_BlogPost_List="-"/>
<Place Parts_Blogs_BlogPost_List_Admin="-"/>
<!-- available display shapes -->
<!--
Parts_Blogs_Blog_Manage
Parts_Blogs_Blog_Description
Parts_Blogs_Blog_Pager
Parts_Blogs_BlogPost_List -> when in the blog detail display the blog post list is currently hard-coded to Content:5 to enable the current state of blog paging
Parts_Blogs_BlogPost_List_Admin
-->
<!-- widget and edit shapes just get default placement -->
<!-- edit "shapes" -->
<Place Parts_Blogs_Blog_Fields="Primary:2"/>
<!-- widgets -->
<Place Parts_Blogs_BlogArchives="Content"/>
<Place Parts_Blogs_RecentBlogPosts="Content"/>
<Match ContentType="Blog">
<Match DisplayType="Detail">
<!-- current paging solution makes this redundant
<Place Parts_Blogs_BlogPost_List="Content:5" /> -->
<!-- blog posts currently added to the blog within the controller into Content:5 <Place Parts_Blogs_BlogPost_List="Content:5" />-->
<Place Parts_Blogs_Blog_Pager="Content:after"
Parts_Blogs_Blog_Description="Content:before" />
</Match>
<Match DisplayType="DetailAdmin">
<Place Parts_Blogs_BlogPost_List_Admin="Content:5"

View File

@@ -5,7 +5,7 @@ namespace Orchard.Blogs {
[OrchardFeature("Remote Blog Publishing")]
public class RemoteBlogPublishingShapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Items_Content__Blog")
builder.Describe("Content__Blog")
.OnDisplaying(displaying => {
if (displaying.ShapeMetadata.DisplayType == "Detail") {
displaying.ShapeMetadata.Wrappers.Add("RemoteBlogPublishing");

View File

@@ -0,0 +1,22 @@
//using Orchard.ContentManagement;
//using Orchard.DisplayManagement.Descriptors;
//namespace Orchard.Blogs {
// public class Shapes : IShapeTableProvider {
// public void Discover(ShapeTableBuilder builder) {
// builder.Describe("Items_Content__Blog")
// .OnCreated(created => {
// var blog = created.Shape;
// blog.Content.Add(created.New.Parts_Blogs_BlogPost_List(ContentPart: blog.ContentItem, ContentItems: blog.));
// })
// .OnDisplaying(displaying => {
// ContentItem contentItem = displaying.Shape.ContentItem;
// if (contentItem != null) {
// var zoneName = contentItem.As<WidgetPart>().Zone;
// displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + contentItem.ContentType);
// displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName);
// }
// });
// }
// }
//}

View File

@@ -1,9 +0,0 @@
using System.Collections.Generic;
using Orchard.Blogs.Models;
namespace Orchard.Blogs.ViewModels {
public class BlogPostArchiveViewModel {
public BlogPart BlogPart { get; set; }
public IEnumerable<KeyValuePair<ArchiveData, int>> Archives { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace Orchard.Blogs.ViewModels {
public class DisplayBlogViewModel {
public dynamic Blog { get; set; }
public dynamic BlogPostList { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
}
}

View File

@@ -1,26 +1,2 @@
@model Orchard.Blogs.ViewModels.DisplayBlogViewModel
@using Orchard.Blogs.Extensions;
@{
Style.Include("pagination.css");
}
@Display(Model.Blog)
@if (Model.BlogPostList.Items.Count > 0) {
@Display(Model.BlogPostList)
<ul class="pagination">
@if(Model.BlogPostList.Items.Count == Model.PageSize) {
<li class="older">
@Html.ActionLink(T("Older Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.Blog.Slug, page = Model.Page + 1 })
</li>
}
@if(Model.Page > 1) {
<li class="newer">
@Html.ActionLink(T("Newer Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.Blog.Slug, page = Model.Page - 1 })
</li>
}
</ul>
}
else {
<p>@T("There are no posts for this blog.")</p>
}
@Display(Model.Meta)
@Display(Model.Content)

View File

@@ -3,6 +3,6 @@
<div>
@Html.LabelFor(m => m.ForBlog)
@Html.TextBoxFor(m => m.ForBlog)
<span class="hint">@T("The blog's slug to display the archives for.")</span>
<span class="hint">@T("Show the archives for which blog? Note: specify the blog's slug.")</span>
</div>
</fieldset>

View File

@@ -0,0 +1,18 @@
@using Orchard.Blogs.Extensions;
@{
Style.Include("pagination.css");
}
@if (Model.ThereIsANextPage || Model.Page > 1) {
<ul class="blog-pagination">
@if(Model.ThereIsANextPage) {
<li class="older">
@Html.ActionLink(T("Older Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.BlogSlug, page = Model.Page + 1 })
</li>
}
@if(Model.Page > 1) {
<li class="newer">
@Html.ActionLink(T("Newer Posts").Text, "Item", new { Area = "Orchard.Blogs", blogSlug = Model.BlogSlug, page = Model.Page - 1 })
</li>
}
</ul>
}

View File

@@ -1,23 +1,20 @@
@model Orchard.Blogs.ViewModels.BlogPostArchiveViewModel
@using Orchard.Blogs.Extensions;
@using Orchard.Blogs.Extensions;
@using Orchard.Blogs.Models;
@{
Style.Require("BlogsArchives");
Script.Require("BlogsArchives");
IEnumerable<KeyValuePair<ArchiveData, int>> archives = Model.Archives;
}
<div class="archives">
<h3>@T("Archives")</h3>
@if (Model.Archives.Count() > 20) {
@if (archives.Count() > 20) {
<ul class="years">
@{
int lastYear = Model.Archives.First().Key.Year;
int firstYear = Model.Archives.Last().Key.Year;
int lastYear = archives.First().Key.Year;
int firstYear = archives.Last().Key.Year;
}
@for (int year = lastYear; year >= firstYear; year--) {
var yearMonths = Model.Archives.Where(m => m.Key.Year == year);
var yearMonths = archives.Where(m => m.Key.Year == year);
if (year == lastYear) {
<li>
@@ -28,15 +25,14 @@
if (year != lastYear) {
<li class="previous">
<h4>@year <span>(@yearMonths.Sum(ym => ym.Value))</span></h4>
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
@Html.UnorderedList(yearMonths, (t, i) => Html.Link(string.Format("{0:MMMM} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((string)Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
</li>
}
}
</ul>
}
else if (Model.Archives.Count() > 0) {
@Html.UnorderedList(Model.Archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth(Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
else if (archives.Count() > 0) {
@Html.UnorderedList(archives, (t, i) => Html.Link(string.Format("{0:MMMM yyyy} ({1})", t.Key.ToDateTime(), t.Value), Url.BlogArchiveMonth((string)Model.BlogPart.Slug, t.Key.Year, t.Key.Month)), "archiveMonthList")
}
else {
<div class="message info">@T("None found")</div>

View File

@@ -1,9 +1,7 @@
@{
IEnumerable<object> blogPosts = Model.BlogPosts;
IEnumerable<object> blogPosts = Model.ContentItems;
}
@Display(ContentItems)
@Display(Model.ContentItems)
@if (blogPosts == null || blogPosts.Count() < 1) {
<p>@T("There are no posts for this blog.")</p>
}
hi

View File

@@ -0,0 +1 @@
@Display(Model.ContentItems)

View File

@@ -42,10 +42,12 @@ using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, Fo
@Html.Hidden("Name", WorkContext.CurrentUser.UserName ?? "")
@Html.Hidden("Email", WorkContext.CurrentUser.Email ?? "")
}
<h2 id="commenter">@if (Request.IsAuthenticated) { @T("Hi, {0}!", Html.Encode(WorkContext.CurrentUser.UserName))}</h2>
<fieldset class="what">
<ol>
<li>
<label for="CommentText">@if (Request.IsAuthenticated) { @T("Hi, {0}!", Html.Encode(WorkContext.CurrentUser.UserName))<br /> } @T("Comment")</label>
<label for="CommentText">@T("Comment")</label>
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
</li>
<li>

View File

@@ -1,10 +1,14 @@
using System.Web.Mvc;
using System.Web.Query.Dynamic;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.Indexing;
using Orchard.Localization;
using Orchard.Search.Services;
using Orchard.Search.ViewModels;
using Orchard.Settings;
using Orchard.Search.Models;
using Orchard.UI.Notify;
using System.Collections.Generic;
using Orchard.Collections;
using Orchard.Themes;
@@ -15,20 +19,38 @@ namespace Orchard.Search.Controllers {
private readonly ISearchService _searchService;
private readonly IContentManager _contentManager;
public SearchController(ISearchService searchService, IContentManager contentManager) {
public SearchController(
IOrchardServices services,
ISearchService searchService,
IContentManager contentManager) {
Services = services;
_searchService = searchService;
_contentManager = contentManager;
T = NullLocalizer.Instance;
}
private IOrchardServices Services { get; set; }
public Localizer T { get; set; }
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
public ActionResult Index(string q, int page = 1, int pageSize = 10) {
var searchFields = CurrentSite.As<SearchSettingsPart>().SearchedFields;
var searchHits = _searchService.Query(q, page, pageSize,
CurrentSite.As<SearchSettingsPart>().Record.FilterCulture,
searchFields,
searchHit => searchHit);
IPageOfItems<ISearchHit> searchHits;
if (q.Trim().StartsWith("?") || q.Trim().StartsWith("*")) {
searchHits = new PageOfItems<ISearchHit>(new ISearchHit[] { });
Services.Notifier.Error(T("'*' or '?' not allowed as first character in WildcardQuery"));
}
else {
searchHits = _searchService.Query(q, page, pageSize,
CurrentSite.As<SearchSettingsPart>().Record.FilterCulture,
searchFields,
searchHit => searchHit);
}
var searchResultViewModels = new List<SearchResultViewModel>();

View File

@@ -5,21 +5,23 @@
@Html.ValidationSummary(T("Login was unsuccessful. Please correct the errors and try again.").ToString())
@using (Html.BeginFormAntiForgeryPost(Url.Action("LogOn", new {ReturnUrl = Request.QueryString["ReturnUrl"]}))) {
<fieldset class="login-form">
<fieldset class="login-form group">
<legend>@T("Account Information")</legend>
<div class="group">
<ol>
<li>
<label for="userNameOrEmail">@T("Username:")</label>
@Html.TextBox("userNameOrEmail", "", new { autofocus = "autofocus" })
@Html.ValidationMessage("userNameOrEmail")
</div>
<div class="group">
</li>
<li>
<label for="password">@T("Password:")</label>
@Html.Password("password")
@Html.ValidationMessage("password")
</div>
<div class="group">
</li>
<li>
@Html.CheckBox("rememberMe")<label class="forcheckbox" for="rememberMe">@T("Remember me?")</label>
</div>
</li>
<input type="submit" value="@T("Log On")" />
</ol>
</fieldset>
}

View File

@@ -116,12 +116,12 @@
<SubType>Designer</SubType>
</None>
<None Include="Views\Admin\Index.cshtml" />
<Content Include="Views\Items_Widget.Editor.cshtml" />
<None Include="Views\Items\Widget.Edit.cshtml" />
<None Include="Views\Items\Widget.cshtml" />
<None Include="Views\Widget.ControlWrapper.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
<Content Include="Views\Items_Widget.cshtml" />
<Content Include="Views\Items\Content-WidgetPage.cshtml" />
<None Include="Views\Widget.Wrapper.cshtml" />
</ItemGroup>

View File

@@ -5,7 +5,7 @@ using Orchard.Widgets.Models;
namespace Orchard.Widgets {
public class Shapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Items_Widget")
builder.Describe("Widget")
.Configure(descriptor => {
// todo: have "alternates" for chrome
//todo: (heskew) something...this still doesn't feel right
@@ -20,8 +20,8 @@ namespace Orchard.Widgets {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
var zoneName = contentItem.As<WidgetPart>().Zone;
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + contentItem.ContentType);
displaying.ShapeMetadata.Alternates.Add("Items_Widget__" + zoneName);
displaying.ShapeMetadata.Alternates.Add("Widget__" + contentItem.ContentType);
displaying.ShapeMetadata.Alternates.Add("Widget__" + zoneName);
}
});
}

View File

@@ -125,9 +125,29 @@
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="Refresh.html" />
<None Include="Themes\Classic\Placement.info">
<SubType>Designer</SubType>
</None>
<Content Include="Themes\Contoso\Styles\search.css" />
<Content Include="Themes\Contoso\Zones\Footer.html" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
<Content Include="Themes\Green\Views\Orchard.Search\Search\Index.ascx" />
<Content Include="Themes\TheAdmin\Scripts\admin.js" />
<Content Include="Themes\TheAdmin\Styles\ie.css" />
<Content Include="Themes\TheAdmin\Styles\images\menuClosed.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuClosedHover.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuOpen.gif" />
<Content Include="Themes\TheAdmin\Styles\images\menuOpenHover.gif" />
<Content Include="Themes\TheThemeMachine\draft.html" />
<Content Include="Themes\TheThemeMachine\Styles\Site.css" />
<Content Include="Themes\TheThemeMachine\Theme.png" />
<Content Include="Themes\TheThemeMachine\Theme.txt" />
<None Include="Themes\Classic\App_Data\Localization\fr-FR\orchard.theme.po" />
<Content Include="Themes\TheThemeMachine\Views\Items\Widget-HtmlWidget.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Themes\TheThemeMachine\Views\User.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
@@ -147,12 +167,163 @@
<Content Include="Config\Diagnostics.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Themes\TheAdmin\Styles\images\icons.png" />
<Content Include="Themes\TheAdmin\Styles\images\tableHeaderBackgroundRed.gif" />
<Content Include="Themes\TheAdmin\Styles\site.css" />
<Content Include="Themes\TheAdmin\Theme.txt" />
<Content Include="Themes\SafeMode\Views\Document.cshtml" />
<Content Include="Themes\TheAdmin\Views\Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Config\Sample.Host.config" />
<Content Include="Themes\ClassicDark\Views\Footer.cshtml" />
<Content Include="Themes\ClassicDark\Views\Layout.cshtml" />
<None Include="Themes\TheAdmin\Styles\images\icons.psd" />
<Content Include="Themes\ClassicDark\Content\Images\bodyBackgroundgrey.gif" />
<Content Include="Themes\ClassicDark\Content\Images\sidebarBackground.gif" />
<Content Include="Themes\ClassicDark\Styles\blog.css" />
<Content Include="Themes\ClassicDark\Styles\site.css" />
<Content Include="Themes\ClassicDark\Theme.png" />
<Content Include="Themes\ClassicDark\Theme.txt" />
<Content Include="Themes\ClassicDark\Zones\Sidebar.html" />
<Content Include="Themes\Classic\Content\Images\sidebarBackground.gif" />
<Content Include="Themes\Classic\Zones\Sidebar.html" />
<Content Include="Themes\Classic\Styles\blog.css" />
<Content Include="Themes\Classic\Styles\site.css" />
<Content Include="Themes\Classic\Theme.png" />
<Content Include="Themes\Classic\Theme.txt" />
<Content Include="Themes\Classic\Views\Footer.cshtml" />
<Content Include="Themes\Classic\Views\Layout.cshtml" />
<Content Include="Themes\Contoso\Content\Images\bkg.jpg" />
<Content Include="Themes\Contoso\Content\Images\comment-arrow.png" />
<Content Include="Themes\Contoso\Content\Images\content-bkg.png" />
<Content Include="Themes\Contoso\Content\Images\content-bottom.png" />
<Content Include="Themes\Contoso\Content\Images\content-top.png" />
<Content Include="Themes\Contoso\Content\Images\feature-bkg-bottom.png" />
<Content Include="Themes\Contoso\Content\Images\feature-bkg-top.png" />
<Content Include="Themes\Contoso\Content\Images\Gallery\feature01.jpg" />
<Content Include="Themes\Contoso\Content\Images\Gallery\feature02.jpg" />
<Content Include="Themes\Contoso\Content\Images\Gallery\feature03.jpg" />
<Content Include="Themes\Contoso\Content\Images\icon-location.png" />
<Content Include="Themes\Contoso\Content\Images\menu-divider.png" />
<Content Include="Themes\Contoso\Content\Images\menu-hover-left.png" />
<Content Include="Themes\Contoso\Content\Images\menu-hover.png" />
<Content Include="Themes\Contoso\Content\Images\menu-left.png" />
<Content Include="Themes\Contoso\Content\Images\menu-right.png" />
<Content Include="Themes\Contoso\Content\Images\nav-arrow-left.png" />
<Content Include="Themes\Contoso\Content\Images\nav-arrow-right.png" />
<Content Include="Themes\Contoso\Content\Images\sub-header.png" />
<Content Include="Themes\Contoso\Zones\Sidebar-w2.html" />
<Content Include="Themes\Contoso\Zones\Sidebar-w3.html" />
<Content Include="Themes\Contoso\Zones\Highlights.html" />
<Content Include="Themes\Contoso\Zones\Home-Headline.html" />
<Content Include="Themes\Contoso\Zones\Home-Hero-Gallery.html" />
<Content Include="Themes\Contoso\Zones\Home-Hero.html" />
<Content Include="Themes\Contoso\Zones\Sidebar-w1.html" />
<Content Include="Themes\Contoso\Scripts\easySlider.js" />
<Content Include="Themes\Contoso\Styles\site.css" />
<Content Include="Themes\Contoso\Theme.png" />
<Content Include="Themes\Contoso\Theme.txt" />
<Content Include="Themes\Corporate\Content\Images\bkg.jpg" />
<Content Include="Themes\Corporate\Content\Images\consult-bkg.png" />
<Content Include="Themes\Corporate\Content\Images\content-bkg.png" />
<Content Include="Themes\Corporate\Content\Images\content-bottom.png" />
<Content Include="Themes\Corporate\Content\Images\content-top.png" />
<Content Include="Themes\Corporate\Content\Images\footer-bkg.jpg" />
<Content Include="Themes\Corporate\Content\Images\footer-bkg.png" />
<Content Include="Themes\Corporate\Content\Images\hm-divider.png" />
<Content Include="Themes\Corporate\Content\Images\hm-header.png" />
<Content Include="Themes\Corporate\Content\Images\icons\icon-5.png" />
<Content Include="Themes\Corporate\Content\Images\icons\icon-4.png" />
<Content Include="Themes\Corporate\Content\Images\icons\icon-3.png" />
<Content Include="Themes\Corporate\Content\Images\icons\icon-2.png" />
<Content Include="Themes\Corporate\Content\Images\icons\icon-1.png" />
<Content Include="Themes\Corporate\Content\Images\jumping-people.jpg" />
<Content Include="Themes\Corporate\Content\Images\logo.png" />
<Content Include="Themes\Corporate\Content\Images\menu-left-over.png" />
<Content Include="Themes\Corporate\Content\Images\menu-left.png" />
<Content Include="Themes\Corporate\Content\Images\menu-right-over.png" />
<Content Include="Themes\Corporate\Content\Images\menu-right.png" />
<Content Include="Themes\Corporate\Content\Images\menu_bkg.jpg" />
<Content Include="Themes\Corporate\Content\Images\notepad.png" />
<Content Include="Themes\Corporate\Scripts\easySlider.js" />
<Content Include="Themes\Corporate\Styles\site.css" />
<Content Include="Themes\Corporate\Theme.png" />
<Content Include="Themes\Corporate\Theme.txt" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ListByArchive.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Contents.Item.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Comments.Comments.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Common.Metadata.ascx" />
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Tags.ShowTags.ascx" />
<Content Include="Themes\Corporate\Views\Footer.ascx" />
<Content Include="Themes\Corporate\Views\Header.ascx" />
<Content Include="Themes\Corporate\Views\Layout.ascx" />
<Content Include="Themes\Corporate\Views\Layout.HomePage.ascx" />
<Content Include="Themes\Corporate\Views\ListOfComments.ascx" />
<Content Include="Themes\Corporate\Views\LogOn.ascx" />
<Content Include="Themes\Corporate\Views\User.ascx" />
<Content Include="Themes\Corporate\Zones\Home-Headline.html" />
<Content Include="Themes\Corporate\Zones\Home-Hero.html" />
<Content Include="Themes\Corporate\Zones\Sidebar-w1.html" />
<Content Include="Themes\Corporate\Zones\Sidebar-w2.html" />
<Content Include="Themes\Corporate\Zones\Sidebar-w3.html" />
<Content Include="Themes\Green\Content\Images\bodyBackground.gif" />
<Content Include="Themes\Green\Content\Images\bodyBackground.png" />
<Content Include="Themes\Green\Content\Images\commentpointer.gif" />
<Content Include="Themes\Green\Content\Images\logo.gif" />
<Content Include="Themes\Green\Content\Images\logo.png" />
<Content Include="Themes\Green\Content\Images\tabLeftOff.gif" />
<Content Include="Themes\Green\Content\Images\tabLeftOn.gif" />
<Content Include="Themes\Green\Content\Images\tabRightOff.gif" />
<Content Include="Themes\Green\Content\Images\tabRightOn.gif" />
<Content Include="Themes\Green\Views\Archives.ascx" />
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
<Content Include="Themes\Green\Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
<Content Include="Themes\Green\Zones\sideBarZone1.html" />
<Content Include="Themes\Green\Zones\sideBarZone2.html" />
<Content Include="Themes\Green\Zones\User2.html" />
<Content Include="Themes\Green\Zones\User3.html" />
<Content Include="Themes\Green\Zones\User1.html" />
<Content Include="Themes\Green\Styles\blog.css" />
<Content Include="Themes\Green\Styles\site.css" />
<Content Include="Themes\Green\Styles\yui.css" />
<Content Include="Themes\Green\Theme.png" />
<Content Include="Themes\Green\Theme.txt" />
<Content Include="Themes\Green\Views\DisplayTemplates\Parts\Common.Metadata.ascx" />
<Content Include="Themes\Green\Views\Layout.HomePage.ascx" />
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
<Content Include="Themes\Green\Views\Footer.ascx" />
<Content Include="Themes\Green\Views\Layout.ascx" />
<Content Include="Themes\Green\Views\ListOfComments.ascx" />
<Content Include="Themes\SafeMode\Content\orchard.ico" />
<Content Include="Themes\SafeMode\Styles\ie6.css" />
<Content Include="Themes\SafeMode\Styles\images\backgroundHeader.gif" />
<Content Include="Themes\SafeMode\Styles\images\backgroundVines.gif" />
<Content Include="Themes\SafeMode\Styles\images\orchardLogo.gif" />
<Content Include="Themes\SafeMode\Styles\site.css" />
<Content Include="Themes\SafeMode\Theme.png" />
<Content Include="Themes\SafeMode\Theme.txt" />
<Content Include="Themes\SafeMode\Views\Layout.cshtml" />
<Content Include="Themes\TheAdmin\Styles\ie6.css" />
<Content Include="Themes\TheAdmin\Styles\images\backgroundGradient.gif" />
<Content Include="Themes\TheAdmin\Styles\images\backgroundHeader.gif" />
<Content Include="Themes\TheAdmin\Styles\images\orchardLogo.gif" />
<Content Include="Themes\TheAdmin\Theme.png" />
<Content Include="Themes\TheAdmin\Views\User.cshtml" />
<Content Include="Themes\TheAdmin\Views\Header.cshtml" />
<Content Include="Themes\TheThemeMachine\Web.config" />
<Content Include="Themes\TheThemeMachine\Views\Items\Content.Blog.cshtml" />
<Content Include="Themes\TheThemeMachine\Views\Items\Widget-Content.cshtml" />
<None Include="Themes\TheThemeMachine\Views\Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Themes\ClassicDark\DesignerNotes\" />
<Folder Include="Themes\SafeMode\Content\Images\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@@ -401,12 +401,16 @@ button:focus, .button:focus {
/* For testing purposes */
#comments {
#comments, #commenter {
font-size:1.6em;
font-weight:600;
margin:1.2em 0 1.8em 1.2em;
}
#commenter {
margin:1.2em 0 0 1em;
}
ul.comments, form.comment {
margin:1.2em 0 1.2em 1.8em;
list-style: none;

View File

@@ -44,6 +44,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tests", "Tools\Orchard.Tests\Orchard.Tests.csproj", "{0DFA2E10-96C8-4E05-BC10-B710B97ECCDE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Notes", "_Notes", "{8A49DB66-40B2-4B6A-BFF0-D4839A240D00}"
ProjectSection(SolutionItems) = preProject
Shapes.txt = Shapes.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard.Web\Modules\Orchard.Modules\Orchard.Modules.csproj", "{17F86780-9A1F-4AA1-86F1-875EEC2730C7}"
EndProject

View File

@@ -61,7 +61,7 @@ namespace Orchard.ContentManagement {
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
stereotype = "Content";
var actualShapeType = "Items_" + stereotype;
var actualShapeType = stereotype;
var actualDisplayType = string.IsNullOrWhiteSpace(displayType) ? "Detail" : displayType;
dynamic itemShape = CreateItemShape(actualShapeType);
@@ -81,7 +81,7 @@ namespace Orchard.ContentManagement {
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
stereotype = "Content";
var actualShapeType = "Items_" + stereotype + "_Editor";
var actualShapeType = stereotype + "_Edit";
dynamic itemShape = CreateItemShape(actualShapeType);
itemShape.ContentItem = content.ContentItem;
@@ -99,7 +99,7 @@ namespace Orchard.ContentManagement {
if (!contentTypeDefinition.Settings.TryGetValue("Stereotype", out stereotype))
stereotype = "Content";
var actualShapeType = "Items_" + stereotype + "_Editor";
var actualShapeType = stereotype + "_Edit";
dynamic itemShape = CreateItemShape(actualShapeType);
itemShape.ContentItem = content.ContentItem;

View File

@@ -15,11 +15,6 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
}
public class BasicShapeTemplateHarvester : IShapeTemplateHarvester {
private readonly IEnumerable<IShapeTemplateViewEngine> _shapeTemplateViewEngines;
public BasicShapeTemplateHarvester(IEnumerable<IShapeTemplateViewEngine> shapeTemplateViewEngines) {
_shapeTemplateViewEngines = shapeTemplateViewEngines;
}
public IEnumerable<string> SubPaths() {
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) {
var leader = "";
if (subPath.StartsWith("Views/")) {
if (subPath.StartsWith("Views/") && subPath != "Views/Items") {
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
// with display and shape api calls)))
var shapeType = leader + fileName.Replace("--", "__").Replace("-", "__").Replace('.', '_');