mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Minor Autoroute cleanup.
This commit is contained in:
parent
b5bc89cb21
commit
8dd6b52909
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user