mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 02:19:23 +08:00
Handlers to redirect creating and editing users to the correct controller (#8549)
This commit is contained in:
parent
a5f657540a
commit
c0fa82fcf9
@ -2,6 +2,7 @@
|
|||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
using Orchard.Users.Models;
|
using Orchard.Users.Models;
|
||||||
|
using System.Web.Routing;
|
||||||
|
|
||||||
namespace Orchard.Users.Handlers {
|
namespace Orchard.Users.Handlers {
|
||||||
public class UserPartHandler : ContentHandler {
|
public class UserPartHandler : ContentHandler {
|
||||||
@ -16,6 +17,19 @@ namespace Orchard.Users.Handlers {
|
|||||||
if (part != null) {
|
if (part != null) {
|
||||||
context.Metadata.Identity.Add("User.UserName", part.UserName);
|
context.Metadata.Identity.Add("User.UserName", part.UserName);
|
||||||
context.Metadata.DisplayText = part.UserName;
|
context.Metadata.DisplayText = part.UserName;
|
||||||
|
|
||||||
|
// Configure routing metadata to make back-office experience more robust
|
||||||
|
context.Metadata.CreateRouteValues = new RouteValueDictionary {
|
||||||
|
{"Area", "Orchard.Users"},
|
||||||
|
{"Controller", "Admin"},
|
||||||
|
{"Action", "Create"}
|
||||||
|
};
|
||||||
|
context.Metadata.EditorRouteValues = new RouteValueDictionary {
|
||||||
|
{"Area", "Orchard.Users"},
|
||||||
|
{"Controller", "Admin"},
|
||||||
|
{"Action", "Edit"},
|
||||||
|
{"id", context.ContentItem.Id}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user