Lynicon's editor system is a generic and adaptable way of providing editing of the data stored in the Data API. Essentially, a DataRoute processing a request uses an inheritor of EditorRedirect (chosen by the type of data being requested) to decide whether the request should be diverted to a special controller. This controller (which will normally inherit from EditorController) creates a page with form elements which when posted back, are used to update the relevant content item via model binding.
Setting the Editor to use for a Route or Content Type
By default, DataRoute uses ContentEditorRedirect which redirects to DualFrameEditorController. This supports the standard page editor.
You can change this behaviour per type or per DataRoute. To change the EditorRedirect used for a DataRoute, do this:
Code Block |
---|
regContext.Routes.AddDataRoute<List<Comment>>("comment-mod-list", "lynicon/comment-mod-list",
new { controller = "Comment", action = "Moderate" },
new WebEditorRedirect(User.EditorRole, User.EditorRole, User.EditorRole,
cl => CommentManager.Instance.AddUrlToComments(CommentManager.Instance.HydrateComments((List<Comment>)cl)), null)); |