mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Using Path on IsRoutable directly in the driver & handler
--HG-- branch : dev
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Orchard.Core.Routable.Drivers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TEMP: path format patterns replaces this logic
|
// TEMP: path format patterns replaces this logic
|
||||||
var path = part.Record.Path;
|
var path = part.Path;
|
||||||
if (path != null && path.EndsWith(part.Slug)) {
|
if (path != null && path.EndsWith(part.Slug)) {
|
||||||
model.DisplayLeadingPath = path.Substring(0, path.Length - part.Slug.Length);
|
model.DisplayLeadingPath = path.Substring(0, path.Length - part.Slug.Length);
|
||||||
}
|
}
|
||||||
@@ -73,10 +73,10 @@ namespace Orchard.Core.Routable.Drivers {
|
|||||||
// TEMP: path format patterns replaces this logic
|
// TEMP: path format patterns replaces this logic
|
||||||
var containerSlug = GetContainerSlug(part);
|
var containerSlug = GetContainerSlug(part);
|
||||||
if (string.IsNullOrEmpty(containerSlug)) {
|
if (string.IsNullOrEmpty(containerSlug)) {
|
||||||
part.Record.Path = model.Slug;
|
part.Path = model.Slug;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
part.Record.Path = containerSlug + "/" + model.Slug;
|
part.Path = containerSlug + "/" + model.Slug;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_routableService.IsSlugValid(part.Slug)) {
|
if (!_routableService.IsSlugValid(part.Slug)) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Orchard.Core.Routable.Handlers {
|
|||||||
_routablePathConstraint = routablePathConstraint;
|
_routablePathConstraint = routablePathConstraint;
|
||||||
Filters.Add(StorageFilter.For(repository));
|
Filters.Add(StorageFilter.For(repository));
|
||||||
|
|
||||||
OnPublished<IsRoutable>((context, routable) => _routablePathConstraint.AddPath(routable.Record.Path));
|
OnPublished<IsRoutable>((context, routable) => _routablePathConstraint.AddPath(routable.Path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class IsRoutableHandler : ContentHandlerBase {
|
public class IsRoutableHandler : ContentHandlerBase {
|
||||||
@@ -23,7 +23,7 @@ namespace Orchard.Core.Routable.Handlers {
|
|||||||
{"Area", "Routable"},
|
{"Area", "Routable"},
|
||||||
{"Controller", "Item"},
|
{"Controller", "Item"},
|
||||||
{"Action", "Display"},
|
{"Action", "Display"},
|
||||||
{"path", routable.Record.Path}
|
{"path", routable.Path}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user