diff --git a/src/Orchard.Web/Core/Common/Controllers/RoutableController.cs b/src/Orchard.Web/Core/Common/Controllers/RoutableController.cs index b0ec8e2b1..7129698a4 100644 --- a/src/Orchard.Web/Core/Common/Controllers/RoutableController.cs +++ b/src/Orchard.Web/Core/Common/Controllers/RoutableController.cs @@ -13,13 +13,18 @@ namespace Orchard.Core.Common.Controllers { } [HttpPost] - public ActionResult Slugify(string contentType, int? containerId) { + public ActionResult Slugify(string contentType, int? id, int? containerId) { var slug = ""; + ContentItem contentItem = null; if (string.IsNullOrEmpty(contentType)) return Json(slug); - var contentItem = _contentManager.New(contentType); + if (id != null) + contentItem = _contentManager.Get((int) id); + + if (contentItem == null) + contentItem = _contentManager.New(contentType); if (containerId != null) { var containerItem = _contentManager.Get((int)containerId); diff --git a/src/Orchard.Web/Core/Common/Scripts/jquery.slugify.js b/src/Orchard.Web/Core/Common/Scripts/jquery.slugify.js index ac3e01214..070202125 100644 --- a/src/Orchard.Web/Core/Common/Scripts/jquery.slugify.js +++ b/src/Orchard.Web/Core/Common/Scripts/jquery.slugify.js @@ -6,6 +6,7 @@ var args = { "contentType": options.contentType, + "id": options.id, "containerId": options.containerId, __RequestVerificationToken: $("input[name=__RequestVerificationToken]").val() }; diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Routable.ascx b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Routable.ascx index b901e4a8c..5b835f8ed 100644 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Routable.ascx +++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts/Common.Routable.ascx @@ -22,7 +22,8 @@ $(this).slugify({ target:$("<%=String.Format("input#{0}Slug", !string.IsNullOrEmpty(Model.Prefix) ? Model.Prefix + "_" : "") %>"), url:"<%=Url.Slugify() %>", - contentType:"<%=Model.RoutableAspect.ContentItem.ContentType %>",<% + contentType:"<%=Model.RoutableAspect.ContentItem.ContentType %>", + id:"<%=Model.RoutableAspect.ContentItem.Id %>",<% var container = Model.RoutableAspect.ContentItem.As().Container; if (container != null) { %> containerId:<%=container.ContentItem.Id %><%