Minor Autoroute cleanup.

This commit is contained in:
Sipke Schoorstra 2015-07-21 16:08:07 +01:00
parent b5bc89cb21
commit 8dd6b52909
4 changed files with 4 additions and 19 deletions

View File

@ -35,9 +35,7 @@ namespace Orchard.Autoroute.Handlers {
PublishAlias(part);
}
});
// OnVersioned<AutoroutePart>((ctx, part1, part2) => CreateAlias(part1));
OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));
// Remove alias if removed or unpublished

View File

@ -126,9 +126,7 @@
<Compile Include="Settings\AutorouteSettings.cs" />
<Compile Include="ViewModels\AutoroutePartEditViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Placement.info">
<SubType>Designer</SubType>

View File

@ -157,16 +157,6 @@ namespace Orchard.Autoroute.Services {
return true;
}
//private bool IsHomePage(IContent content) {
// var homePageRoute = _aliasService.Get("");
// var homePageId = homePageRoute.ContainsKey("id") ? XmlHelper.Parse<int>((string)homePageRoute["id"]) : default(int?);
// return content.Id == homePageId;
//}
//private int GetHomePageAliasRecordId() {
// return _aliasStorage.List(x => x.Path == "").First().Item5;
//}
private SettingsDictionary GetTypePartSettings(string contentType) {
var contentDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);

View File

@ -6,7 +6,7 @@ using Orchard.Data;
namespace Orchard.Autoroute.Services {
public class PathResolutionService : IPathResolutionService {
private readonly IContentManager _contentManager;
IRepository<AutoroutePartRecord> _autorouteRepository;
private readonly IRepository<AutoroutePartRecord> _autorouteRepository;
public PathResolutionService(
IRepository<AutoroutePartRecord> autorouteRepository,
@ -17,8 +17,7 @@ namespace Orchard.Autoroute.Services {
public AutoroutePart GetPath(string path) {
var autorouteRecord = _autorouteRepository.Table
.Where(part => part.DisplayAlias == path && part.ContentItemVersionRecord.Published)
.FirstOrDefault();
.FirstOrDefault(part => part.DisplayAlias == path && part.ContentItemVersionRecord.Published);
if (autorouteRecord == null) {
return null;