IsRoutable -> RoutePart

- updating part names to conform to a <name>Part convention

--HG--
branch : dev
rename : src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs => src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs
rename : src/Orchard.Web/Core/Routable/Handlers/RoutableHandler.cs => src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs
rename : src/Orchard.Web/Core/Routable/Models/IsRoutable.cs => src/Orchard.Web/Core/Routable/Models/RoutePart.cs
rename : src/Orchard.Web/Core/Routable/Models/RoutableRecord.cs => src/Orchard.Web/Core/Routable/Models/RoutePartRecord.cs
rename : src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.IsRoutable.ascx => src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.RoutePart.ascx
This commit is contained in:
Nathan Heskew
2010-07-23 01:01:49 -07:00
parent 2e9eff17e0
commit f482c738ec
28 changed files with 101 additions and 101 deletions

View File

@@ -40,7 +40,7 @@ namespace Orchard.Core.Tests.Common.Services {
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
builder.RegisterInstance(new UrlHelper(new RequestContext(new StubHttpContext("~/"), new RouteData()))).As<UrlHelper>();
builder.RegisterType<RoutableHandler>().As<IContentHandler>();
builder.RegisterType<RoutePartHandler>().As<IContentHandler>();
}
@@ -51,11 +51,11 @@ namespace Orchard.Core.Tests.Common.Services {
var contentManager = _container.Resolve<IContentManager>();
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "Please do not use any of the following characters in your slugs: \":\", \"/\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"";
});
_routableService.FillSlug(thing.As<IsRoutable>());
_routableService.FillSlug(thing.As<RoutePart>());
Assert.That(thing.Slug, Is.EqualTo("please-do-not-use-any-of-the-following-characters-in-your-slugs-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\"-\""));
}
@@ -87,11 +87,11 @@ namespace Orchard.Core.Tests.Common.Services {
veryVeryLongTitle += "aaaaaaaaaa";
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = veryVeryLongTitle;
});
_routableService.FillSlug(thing.As<IsRoutable>());
_routableService.FillSlug(thing.As<RoutePart>());
Assert.That(veryVeryLongTitle.Length, Is.AtLeast(1001));
Assert.That(thing.Slug.Length, Is.EqualTo(1000));
@@ -138,11 +138,11 @@ namespace Orchard.Core.Tests.Common.Services {
var contentManager = _container.Resolve<IContentManager>();
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "This Is Some Interesting Title";
});
_routableService.FillSlug(thing.As<IsRoutable>());
_routableService.FillSlug(thing.As<RoutePart>());
Assert.That(thing.Slug, Is.EqualTo("this-is-some-interesting-title"));
}
@@ -152,12 +152,12 @@ namespace Orchard.Core.Tests.Common.Services {
var contentManager = _container.Resolve<IContentManager>();
var thing1 = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "This Is Some Interesting Title";
});
var thing2 = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "This Is Some Interesting Title";
});
@@ -169,12 +169,12 @@ namespace Orchard.Core.Tests.Common.Services {
var contentManager = _container.Resolve<IContentManager>();
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
t.As<IsRoutable>().Record = new RoutableRecord();
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "This Is Some Interesting Title";
});
var stuff = contentManager.Create<Stuff>(StuffDriver.ContentType.Name, s => {
s.As<IsRoutable>().Record = new RoutableRecord();
s.As<RoutePart>().Record = new RoutePartRecord();
s.Title = "This Is Some Interesting Title";
});
@@ -185,7 +185,7 @@ namespace Orchard.Core.Tests.Common.Services {
protected override IEnumerable<Type> DatabaseTypes {
get {
return new[] {
typeof(RoutableRecord),
typeof(RoutePartRecord),
typeof(ContentTypeRecord),
typeof(ContentItemRecord),
typeof(ContentItemVersionRecord),
@@ -201,7 +201,7 @@ namespace Orchard.Core.Tests.Common.Services {
Filters.Add(new ActivatingFilter<Thing>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<CommonPart>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<IsRoutable>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<RoutePart>(ThingDriver.ContentType.Name));
}
}
@@ -209,13 +209,13 @@ namespace Orchard.Core.Tests.Common.Services {
public int Id { get { return ContentItem.Id; } }
public string Title {
get { return this.As<IsRoutable>().Title; }
set { this.As<IsRoutable>().Title = value; }
get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; }
}
public string Slug {
get { return this.As<IsRoutable>().Slug; }
set { this.As<IsRoutable>().Slug = value; }
get { return this.As<RoutePart>().Slug; }
set { this.As<RoutePart>().Slug = value; }
}
}
@@ -232,7 +232,7 @@ namespace Orchard.Core.Tests.Common.Services {
Filters.Add(new ActivatingFilter<Stuff>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<CommonPart>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<IsRoutable>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<RoutePart>(StuffDriver.ContentType.Name));
}
}
@@ -240,13 +240,13 @@ namespace Orchard.Core.Tests.Common.Services {
public int Id { get { return ContentItem.Id; } }
public string Title {
get { return this.As<IsRoutable>().Title; }
set { this.As<IsRoutable>().Title = value; }
get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; }
}
public string Slug {
get { return this.As<IsRoutable>().Slug; }
set { this.As<IsRoutable>().Slug = value; }
get { return this.As<RoutePart>().Slug; }
set { this.As<RoutePart>().Slug = value; }
}
}

View File

@@ -149,16 +149,16 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
var clock = new StubClock();
var hello = new ContentItemBuilder(new ContentTypeDefinitionBuilder().Named("hello").Build())
.Weld<CommonPart>()
.Weld<IsRoutable>()
.Weld<RoutePart>()
.Weld<BodyPart>()
.Build();
hello.As<CommonPart>().Record = new CommonPartRecord();
hello.As<IsRoutable>().Record = new RoutableRecord();
hello.As<RoutePart>().Record = new RoutePartRecord();
hello.As<BodyPart>().Record = new BodyPartRecord();
hello.As<CommonPart>().PublishedUtc = clock.UtcNow;
hello.As<IsRoutable>().Title = "alpha";
hello.As<IsRoutable>().Slug = "beta";
hello.As<RoutePart>().Title = "alpha";
hello.As<RoutePart>().Slug = "beta";
hello.As<BodyPart>().Text = "gamma";
var query = new StubQuery(new[] {

View File

@@ -93,7 +93,7 @@ namespace Orchard.Core.Common.Drivers {
if (common == null)
return this;
var routable = common.Container.As<IsRoutable>();
var routable = common.Container.As<RoutePart>();
if (routable == null)
return this;
@@ -102,7 +102,7 @@ namespace Orchard.Core.Common.Drivers {
}
public PathBuilder AddSlug() {
var routable = _content.As<IsRoutable>();
var routable = _content.As<RoutePart>();
if (routable == null)
return this;

View File

@@ -10,14 +10,14 @@ namespace Orchard.Core.Feeds.StandardBuilders {
private readonly IContent _item;
private readonly ContentItemMetadata _metadata;
private readonly ICommonPart _common;
private readonly IsRoutable _routable;
private readonly RoutePart _routable;
private readonly BodyPart _body;
public ItemInspector(IContent item, ContentItemMetadata metadata) {
_item = item;
_metadata = metadata;
_common = item.Get<ICommonPart>();
_routable = item.Get<IsRoutable>();
_routable = item.Get<RoutePart>();
_body = item.Get<BodyPart>();
}

View File

@@ -114,10 +114,10 @@
<Compile Include="Reports\ViewModels\ReportsAdminIndexViewModel.cs" />
<Compile Include="Routable\Controllers\ItemController.cs" />
<Compile Include="Routable\DataMigrations\RoutableDataMigration.cs" />
<Compile Include="Routable\Drivers\RoutableDriver.cs" />
<Compile Include="Routable\Handlers\RoutableHandler.cs" />
<Compile Include="Routable\Drivers\RoutePartDriver.cs" />
<Compile Include="Routable\Handlers\RoutePartHandler.cs" />
<Compile Include="Routable\IRoutablePathConstraint.cs" />
<Compile Include="Routable\Models\IsRoutable.cs" />
<Compile Include="Routable\Models\RoutePart.cs" />
<Compile Include="Common\Permissions.cs" />
<Compile Include="Common\Models\CommonPartVersionRecord.cs" />
<Compile Include="Common\Utilities\LazyField.cs" />
@@ -176,7 +176,7 @@
<Compile Include="Navigation\ViewModels\MenuItemEntry.cs" />
<Compile Include="Navigation\ViewModels\NavigationManagementViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routable\Models\RoutableRecord.cs" />
<Compile Include="Routable\Models\RoutePartRecord.cs" />
<Compile Include="Routable\Routes.cs" />
<Compile Include="Routable\Services\IRoutableService.cs" />
<Compile Include="Routable\Services\RoutablePathConstraint.cs" />
@@ -297,7 +297,7 @@
<Content Include="Localization\Views\CultureSelection.ascx" />
<Content Include="Routable\Module.txt" />
<Content Include="Routable\Scripts\jquery.slugify.js" />
<Content Include="Routable\Views\EditorTemplates\Parts\Routable.IsRoutable.ascx" />
<Content Include="Routable\Views\EditorTemplates\Parts\Routable.RoutePart.ascx" />
<Content Include="Routable\Views\Item\Display.ascx" />
<Content Include="Settings\Module.txt" />
<Content Include="Settings\Styles\admin.css" />

View File

@@ -30,7 +30,7 @@ namespace Orchard.Core.Routable.Controllers {
}
var hits = _contentManager
.Query<IsRoutable, RoutableRecord>(VersionOptions.Published)
.Query<RoutePart, RoutePartRecord>(VersionOptions.Published)
.Where(r => r.Path == matchedPath)
.Slice(0, 2);
if (hits.Count() == 0) {

View File

@@ -10,7 +10,7 @@ namespace Orchard.Core.Routable.DataMigrations {
public int Create() {
//CREATE TABLE Routable_RoutableRecord (Id INTEGER not null, Title TEXT, Slug TEXT, Path TEXT, ContentItemRecord_id INTEGER, primary key (Id));
SchemaBuilder.CreateTable("RoutableRecord", table => table
SchemaBuilder.CreateTable("RoutePartRecord", table => table
.ContentPartVersionRecord()
.Column<string>("Title", column => column.WithLength(1024))
.Column<string>("Slug")
@@ -21,7 +21,7 @@ namespace Orchard.Core.Routable.DataMigrations {
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(IsRoutable).Name, cfg => cfg
ContentDefinitionManager.AlterPartDefinition(typeof(RoutePart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "before.5" }}
} ));

View File

@@ -9,17 +9,17 @@ using Orchard.Localization;
using Orchard.UI.Notify;
namespace Orchard.Core.Routable.Drivers {
public class RoutableDriver : ContentPartDriver<IsRoutable> {
public class RoutePartDriver : ContentPartDriver<RoutePart> {
private readonly IOrchardServices _services;
private readonly IRoutableService _routableService;
public RoutableDriver(IOrchardServices services, IRoutableService routableService) {
public RoutePartDriver(IOrchardServices services, IRoutableService routableService) {
_services = services;
_routableService = routableService;
T = NullLocalizer.Instance;
}
private const string TemplateName = "Parts/Routable.IsRoutable";
private const string TemplateName = "Parts/Routable.RoutePart";
public Localizer T { get; set; }
@@ -46,7 +46,7 @@ namespace Orchard.Core.Routable.Drivers {
return null;
}
protected override DriverResult Editor(IsRoutable part) {
protected override DriverResult Editor(RoutePart part) {
var model = new RoutableEditorViewModel {
ContentType = part.ContentItem.ContentType,
Id = part.ContentItem.Id,
@@ -71,7 +71,7 @@ namespace Orchard.Core.Routable.Drivers {
return ContentPartTemplate(model, TemplateName, Prefix).Location(location);
}
protected override DriverResult Editor(IsRoutable part, IUpdateModel updater) {
protected override DriverResult Editor(RoutePart part, IUpdateModel updater) {
var model = new RoutableEditorViewModel();
updater.TryUpdateModel(model, Prefix, null, null);

View File

@@ -5,22 +5,22 @@ using Orchard.Core.Routable.Models;
using Orchard.Data;
namespace Orchard.Core.Routable.Handlers {
public class RoutableHandler : ContentHandler {
public class RoutePartHandler : ContentHandler {
private readonly IRoutablePathConstraint _routablePathConstraint;
public RoutableHandler(IRepository<RoutableRecord> repository, IRoutablePathConstraint routablePathConstraint) {
public RoutePartHandler(IRepository<RoutePartRecord> repository, IRoutablePathConstraint routablePathConstraint) {
_routablePathConstraint = routablePathConstraint;
Filters.Add(StorageFilter.For(repository));
OnPublished<IsRoutable>((context, routable) => {
OnPublished<RoutePart>((context, routable) => {
if (!string.IsNullOrEmpty(routable.Path))
_routablePathConstraint.AddPath(routable.Path);
});
}
}
public class IsRoutableHandler : ContentHandlerBase {
public class RoutePartHandlerBase : ContentHandlerBase {
public override void GetContentItemMetadata(GetContentItemMetadataContext context) {
var routable = context.ContentItem.As<IsRoutable>();
var routable = context.ContentItem.As<RoutePart>();
if (routable != null) {
context.Metadata.DisplayRouteValues = new RouteValueDictionary {
{"Area", "Routable"},

View File

@@ -2,7 +2,7 @@
using Orchard.ContentManagement.Aspects;
namespace Orchard.Core.Routable.Models {
public class IsRoutable : ContentPart<RoutableRecord>, IRoutableAspect {
public class RoutePart : ContentPart<RoutePartRecord>, IRoutableAspect {
public string Title {
get { return Record.Title; }
set { Record.Title = value; }

View File

@@ -2,7 +2,7 @@
using Orchard.ContentManagement.Records;
namespace Orchard.Core.Routable.Models {
public class RoutableRecord : ContentPartVersionRecord {
public class RoutePartRecord : ContentPartVersionRecord {
[StringLength(1024)]
public virtual string Title { get; set; }

View File

@@ -4,14 +4,14 @@ using Orchard.Core.Routable.Models;
namespace Orchard.Core.Routable.Services {
public interface IRoutableService : IDependency {
void FillSlug<TModel>(TModel model) where TModel : IsRoutable;
void FillSlug<TModel>(TModel model, Func<string, string> generateSlug) where TModel : IsRoutable;
void FillSlug<TModel>(TModel model) where TModel : RoutePart;
void FillSlug<TModel>(TModel model, Func<string, string> generateSlug) where TModel : RoutePart;
string GenerateUniqueSlug(string slugCandidate, IEnumerable<string> existingSlugs);
/// <summary>
/// Returns any content item of the specified content type with similar slugs
/// </summary>
IEnumerable<IsRoutable> GetSimilarSlugs(string contentType, string slug);
IEnumerable<RoutePart> GetSimilarSlugs(string contentType, string slug);
/// <summary>
/// Validates the given slug
@@ -22,7 +22,7 @@ namespace Orchard.Core.Routable.Services {
/// Defines the slug of a RoutableAspect and validate its unicity
/// </summary>
/// <returns>True if the slug has been created, False if a conflict occured</returns>
bool ProcessSlug(IsRoutable part);
bool ProcessSlug(RoutePart part);
}
}

View File

@@ -28,11 +28,11 @@ namespace Orchard.Core.Routable.Services {
public ActionResult GetHomePage(int itemId) {
var contentItem = _contentManager.Get(itemId, VersionOptions.Published);
if (contentItem == null || !contentItem.Is<IsRoutable>())
if (contentItem == null || !contentItem.Is<RoutePart>())
return new NotFoundResult();
var model = new RoutableDisplayViewModel {
Routable = _contentManager.BuildDisplayModel<IRoutableAspect>(contentItem.As<IsRoutable>(), "Detail")
Routable = _contentManager.BuildDisplayModel<IRoutableAspect>(contentItem.As<RoutePart>(), "Detail")
};
return new ViewResult {

View File

@@ -9,9 +9,9 @@ namespace Orchard.Core.Routable.Services {
[UsedImplicitly]
public class RoutablePathConstraintUpdator : IOrchardShellEvents, IBackgroundTask {
private readonly IRoutablePathConstraint _pageSlugConstraint;
private readonly IRepository<RoutableRecord> _repository;
private readonly IRepository<RoutePartRecord> _repository;
public RoutablePathConstraintUpdator(IRoutablePathConstraint pageSlugConstraint, IRepository<RoutableRecord> repository) {
public RoutablePathConstraintUpdator(IRoutablePathConstraint pageSlugConstraint, IRepository<RoutePartRecord> repository) {
_pageSlugConstraint = pageSlugConstraint;
_repository = repository;
}

View File

@@ -14,7 +14,7 @@ namespace Orchard.Core.Routable.Services {
_contentManager = contentManager;
}
public void FillSlug<TModel>(TModel model) where TModel : IsRoutable {
public void FillSlug<TModel>(TModel model) where TModel : RoutePart {
if (!string.IsNullOrEmpty(model.Slug) || string.IsNullOrEmpty(model.Title))
return;
@@ -30,7 +30,7 @@ namespace Orchard.Core.Routable.Services {
model.Slug = slug.ToLowerInvariant();
}
public void FillSlug<TModel>(TModel model, Func<string, string> generateSlug) where TModel : IsRoutable {
public void FillSlug<TModel>(TModel model, Func<string, string> generateSlug) where TModel : RoutePart {
if (!string.IsNullOrEmpty(model.Slug) || string.IsNullOrEmpty(model.Title))
return;
@@ -60,12 +60,12 @@ namespace Orchard.Core.Routable.Services {
: null;
}
public IEnumerable<IsRoutable> GetSimilarSlugs(string contentType, string slug)
public IEnumerable<RoutePart> GetSimilarSlugs(string contentType, string slug)
{
return
_contentManager.Query().Join<RoutableRecord>()
_contentManager.Query().Join<RoutePartRecord>()
.List()
.Select(i => i.As<IsRoutable>())
.Select(i => i.As<RoutePart>())
.Where(routable => routable.Path != null && routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith
.ToArray();
}
@@ -75,7 +75,7 @@ namespace Orchard.Core.Routable.Services {
return slug == null || String.IsNullOrEmpty(slug.Trim()) || Regex.IsMatch(slug, @"^[^/:?#\[\]@!$&'()*+,;=\s]+$");
}
public bool ProcessSlug(IsRoutable part)
public bool ProcessSlug(RoutePart part)
{
FillSlug(part);

View File

@@ -54,8 +54,8 @@ namespace Orchard.Blogs.Commands {
var blog = _contentManager.New("Blog");
blog.As<ICommonPart>().Owner = admin;
blog.As<IsRoutable>().Slug = Slug;
blog.As<IsRoutable>().Title = Title;
blog.As<RoutePart>().Slug = Slug;
blog.As<RoutePart>().Title = Title;
if ( !String.IsNullOrWhiteSpace(MenuText) ) {
blog.As<MenuPart>().OnMainMenu = true;
blog.As<MenuPart>().MenuPosition = _menuService.Get().Select(menuPart => menuPart.MenuPosition).Max() + 1 + ".0";
@@ -97,8 +97,8 @@ namespace Orchard.Blogs.Commands {
var post = _contentManager.New("BlogPost");
post.As<ICommonPart>().Owner = admin;
post.As<ICommonPart>().Container = blog;
post.As<IsRoutable>().Slug = Slugify(postName);
post.As<IsRoutable>().Title = postName;
post.As<RoutePart>().Slug = Slugify(postName);
post.As<RoutePart>().Title = postName;
post.As<BodyPart>().Text = item.Element("description").Value;
_contentManager.Create(post);
}

View File

@@ -33,7 +33,7 @@ namespace Orchard.Blogs.DataMigrations {
cfg => cfg
.WithPart("BlogPart")
.WithPart("CommonPart")
.WithPart("IsRoutable")
.WithPart("RoutePart")
);
ContentDefinitionManager.AlterTypeDefinition("BlogPost",
@@ -41,7 +41,7 @@ namespace Orchard.Blogs.DataMigrations {
.WithPart("BlogPostPart")
.WithPart("CommonPart")
.WithPart("PublishLaterPart")
.WithPart("IsRoutable")
.WithPart("RoutePart")
.WithPart("BodyPart")
);

View File

@@ -8,14 +8,14 @@ namespace Orchard.Blogs.Models {
public int Id { get { return ContentItem.Id; } }
public string Name {
get { return this.As<IsRoutable>().Title; }
set { this.As<IsRoutable>().Title = value; }
get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; }
}
//TODO: (erikpo) Need a data type for slug
public string Slug {
get { return this.As<IsRoutable>().Slug; }
set { this.As<IsRoutable>().Slug = value; }
get { return this.As<RoutePart>().Slug; }
set { this.As<RoutePart>().Slug = value; }
}
public string Description {

View File

@@ -14,13 +14,13 @@ namespace Orchard.Blogs.Models {
}
public string Title {
get { return this.As<IsRoutable>().Title; }
set { this.As<IsRoutable>().Title = value; }
get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; }
}
public string Slug {
get { return this.As<IsRoutable>().Slug; }
set { this.As<IsRoutable>().Slug = value; }
get { return this.As<RoutePart>().Slug; }
set { this.As<RoutePart>().Slug = value; }
}
public string Text {

View File

@@ -29,7 +29,7 @@ namespace Orchard.Blogs.Services {
public BlogPostPart Get(BlogPart blogPart, string slug, VersionOptions versionOptions) {
return
_contentManager.Query(versionOptions, BlogPostPartDriver.ContentType.Name).Join<RoutableRecord>().Where(rr => rr.Slug == slug).
_contentManager.Query(versionOptions, BlogPostPartDriver.ContentType.Name).Join<RoutePartRecord>().Where(rr => rr.Slug == slug).
Join<CommonPartRecord>().Where(cr => cr.Container == blogPart.Record.ContentItemRecord).List().
SingleOrDefault().As<BlogPostPart>();
}

View File

@@ -20,13 +20,13 @@ namespace Orchard.Blogs.Services {
public BlogPart Get(string slug) {
return _contentManager.Query<BlogPart, BlogPartRecord>()
.Join<RoutableRecord>().Where(rr => rr.Slug == slug)
.Join<RoutePartRecord>().Where(rr => rr.Slug == slug)
.List().FirstOrDefault();
}
public IEnumerable<BlogPart> Get() {
return _contentManager.Query<BlogPart, BlogPartRecord>()
.Join<RoutableRecord>()
.Join<RoutePartRecord>()
.OrderBy(br => br.Title)
.List();
}

View File

@@ -27,9 +27,9 @@ namespace Orchard.DevTools.Commands {
var pageName = "page" + index;
var page = _contentManager.Create("Page", VersionOptions.Draft);
page.As<ICommonPart>().Owner = admin;
page.As<IsRoutable>().Slug = pageName;
page.As<IsRoutable>().Path = pageName;
page.As<IsRoutable>().Title = pageName;
page.As<RoutePart>().Slug = pageName;
page.As<RoutePart>().Path = pageName;
page.As<RoutePart>().Title = pageName;
page.As<BodyPart>().Text = pageName;
page.As<MenuPart>().OnMainMenu = true;
page.As<MenuPart>().MenuPosition = "5." + index;
@@ -39,9 +39,9 @@ namespace Orchard.DevTools.Commands {
var blogName = "blog" + index;
var blog = _contentManager.New("Blog");
blog.As<ICommonPart>().Owner = admin;
blog.As<IsRoutable>().Slug = blogName;
blog.As<IsRoutable>().Path = blogName;
blog.As<IsRoutable>().Title = blogName;
blog.As<RoutePart>().Slug = blogName;
blog.As<RoutePart>().Path = blogName;
blog.As<RoutePart>().Title = blogName;
blog.As<MenuPart>().OnMainMenu = true;
blog.As<MenuPart>().MenuPosition = "6." + index;
blog.As<MenuPart>().MenuText = blogName;

View File

@@ -10,7 +10,7 @@ namespace Orchard.Pages.DataMigrations {
cfg => cfg
.WithPart("Page")
.WithPart("CommonPart")
.WithPart("IsRoutable")
.WithPart("RoutePart")
.WithPart("BodyPart")
);

View File

@@ -12,12 +12,12 @@ namespace Orchard.Pages.Models {
public int Id { get { return ContentItem.Id; } }
public string Title {
get { return this.As<IsRoutable>().Title; }
get { return this.As<RoutePart>().Title; }
}
public string Slug {
get { return this.As<IsRoutable>().Slug; }
set { this.As<IsRoutable>().Slug = value; }
get { return this.As<RoutePart>().Slug; }
set { this.As<RoutePart>().Slug = value; }
}
public IUser Creator {

View File

@@ -35,11 +35,11 @@ namespace Orchard.Pages.Services {
public IEnumerable<Page> Get(PageStatus status) {
switch (status) {
case PageStatus.All:
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Latest).List().AsPart<Page>();
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutePartRecord>().ForVersion(VersionOptions.Latest).List().AsPart<Page>();
case PageStatus.Published:
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Published).List().AsPart<Page>();
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutePartRecord>().ForVersion(VersionOptions.Published).List().AsPart<Page>();
case PageStatus.Offline:
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().ForVersion(VersionOptions.Latest).Where<ContentPartVersionRecord>(ci => !ci.ContentItemVersionRecord.Published).List().AsPart<Page>();
return _contentManager.Query(PageDriver.ContentType.Name).Join<RoutePartRecord>().ForVersion(VersionOptions.Latest).Where<ContentPartVersionRecord>(ci => !ci.ContentItemVersionRecord.Published).List().AsPart<Page>();
default:
return Enumerable.Empty<Page>();
}
@@ -51,7 +51,7 @@ namespace Orchard.Pages.Services {
public Page Get(string slug) {
return
_contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
_contentManager.Query(PageDriver.ContentType.Name).Join<RoutePartRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
().As<Page>();
}
@@ -61,7 +61,7 @@ namespace Orchard.Pages.Services {
public Page GetLatest(string slug) {
return
_contentManager.Query(VersionOptions.Latest, PageDriver.ContentType.Name).Join<RoutableRecord>().Where(rr => rr.Slug == slug)
_contentManager.Query(VersionOptions.Latest, PageDriver.ContentType.Name).Join<RoutePartRecord>().Where(rr => rr.Slug == slug)
.Slice(0, 1).FirstOrDefault().As<Page>();
}

View File

@@ -24,7 +24,7 @@ namespace Orchard.Sandbox.DataMigrations {
cfg => cfg
.WithPart("SandboxPagePart")
.WithPart("CommonPart")
.WithPart("IsRoutable")
.WithPart("RoutePart")
.WithPart("BodyPart")
);

View File

@@ -202,7 +202,7 @@ namespace Orchard.Setup.Services {
.DisplayedAs("Page")
.WithPart("CommonPart")
.WithPart("PublishLaterPart")
.WithPart("IsRoutable")
.WithPart("RoutePart")
.WithPart("BodyPart")
.WithPart("CommentsPart")
.WithPart("TagsPart")
@@ -215,9 +215,9 @@ namespace Orchard.Setup.Services {
// create home page as a CMS page
var page = contentManager.Create("Page", VersionOptions.Draft);
page.As<BodyPart>().Text = "<p>Welcome to Orchard!</p><p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"Admin/Pages/Edit/3\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
page.As<IsRoutable>().Slug = "home";
page.As<IsRoutable>().Path = "home";
page.As<IsRoutable>().Title = T("Home").ToString();
page.As<RoutePart>().Slug = "home";
page.As<RoutePart>().Path = "home";
page.As<RoutePart>().Title = T("Home").ToString();
page.As<CommonPart>().Owner = user;
if (page.Has<CommentsPart>()) {
page.As<CommentsPart>().CommentsShown = false;