mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-19 17:51:45 +08:00
Updating the Routeable slugify to use the item's path
--HG-- branch : dev
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization;
|
||||
@@ -62,7 +63,7 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
contentItem = _contentManager.Get((int)id, VersionOptions.Latest);
|
||||
|
||||
if (contentItem == null) {
|
||||
contentItem = _contentManager.New(contentType);
|
||||
contentItem = _contentManager.Create(contentType, VersionOptions.Draft);
|
||||
|
||||
if (containerId != null) {
|
||||
var containerItem = _contentManager.Get((int)containerId);
|
||||
@@ -71,9 +72,10 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
}
|
||||
|
||||
_contentManager.UpdateEditor(contentItem, this);
|
||||
_contentManager.Publish(contentItem);
|
||||
_transactionManager.Cancel();
|
||||
|
||||
return Json(contentItem.As<IRoutableAspect>().Slug ?? slug);
|
||||
return Json(contentItem.As<IRoutableAspect>().GetEffectiveSlug() ?? slug);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,10 +79,6 @@ namespace Orchard.Core.Routable.Drivers {
|
||||
updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead)."));
|
||||
}
|
||||
|
||||
if (!_routableService.ProcessSlug(part))
|
||||
_services.Notifier.Warning(T("Slugs in conflict. \"{0}\" is already set for a previously created {2} so now it has the slug \"{1}\"",
|
||||
part.Slug, part.GetEffectiveSlug(), part.ContentItem.ContentType));
|
||||
|
||||
if (part.ContentItem.Id != 0 && model.PromoteToHomePage && _routableHomePageProvider != null)
|
||||
_services.WorkContext.CurrentSite.HomePage = _routableHomePageProvider.GetSettingValue(part.ContentItem.Id);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Orchard.Core.Routable.Handlers {
|
||||
OnGetEditorShape<RoutePart>(SetModelProperties);
|
||||
OnUpdateEditorShape<RoutePart>(SetModelProperties);
|
||||
|
||||
OnPublished<RoutePart>((context, routable) => {
|
||||
OnPublishing<RoutePart>((context, routable) => {
|
||||
if (context.PublishingItemVersionRecord != null)
|
||||
processSlug(routable);
|
||||
if (!string.IsNullOrEmpty(routable.Path))
|
||||
|
||||
Reference in New Issue
Block a user