mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Corrected unique slugs management
- Two different blogs can have a blog post with the same slug - Other routable items can have the same slug if hte whole path is unique (e.g. Page) --HG-- branch : dev
This commit is contained in:
parent
9ac4209127
commit
0acd1f3e91
@ -66,7 +66,7 @@ namespace Orchard.Core.Routable.Services {
|
||||
_contentManager.Query(contentType).Join<RoutableRecord>()
|
||||
.List()
|
||||
.Select(i => i.As<IsRoutable>())
|
||||
.Where(routable => routable.Slug.StartsWith(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith
|
||||
.Where(routable => routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ namespace Orchard.Core.Routable.Services {
|
||||
return true;
|
||||
}
|
||||
|
||||
var slugsLikeThis = GetSimilarSlugs(part.ContentItem.ContentType, part.Slug);
|
||||
var slugsLikeThis = GetSimilarSlugs(part.ContentItem.ContentType, part.Path);
|
||||
|
||||
// If the part is already a valid content item, don't include it in the list
|
||||
// of slug to consider for conflict detection
|
||||
|
@ -5,9 +5,9 @@
|
||||
<div class="summary">
|
||||
<div class="related">
|
||||
<a href="<%: Url.Blog(Model.Item.Slug) %>" title="<%: T("View") %>"><%: T("View") %></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogForAdmin(Model.Item.Slug) %>" title="<%: T("Edit Posts") %>"><%: T("Edit Posts")%></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogForAdmin(Model.Item.Slug) %>" title="<%: T("List Posts") %>"><%: T("List Posts")%></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogPostCreate(Model.Item) %>" title="<%: T("New Post") %>"><%: T("New Post") %></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogEdit(Model.Item.Slug) %>" title="<%: T("Settings") %>"><%: T("Settings") %></a><%: T(" | ")%>
|
||||
<a href="<%: Url.BlogEdit(Model.Item.Slug) %>" title="<%: T("Edit") %>"><%: T("Edit")%></a><%: T(" | ")%>
|
||||
<%-- todo: (heskew) this is waaaaa too verbose. need template helpers for all ibuttons --%>
|
||||
<% using (Html.BeginFormAntiForgeryPost(Url.BlogRemove(Model.Item.Slug), FormMethod.Post, new { @class = "inline link" })) { %>
|
||||
<button type="submit" class="linkButton" title="<%: T("Remove") %>"><%: T("Remove") %></button><%
|
||||
|
Loading…
Reference in New Issue
Block a user