Adding MetaData Route Values

Topics: General, Writing modules
Feb 4, 2013 at 3:45 PM
The task set upon me is to add a Preview button for pages and blog posts that will save the content and than open in a new window a preview of that content. I have approached this in several different manners but can't seem to figure out the correct way of doing this. We also do not want to change the code base of Orchard.

I was wondering is it possible to simply just add a route value to the MetaData without changing them all. When I add one in my module in my Handler it changes the actions to everything on either the blog post and page.
 public class PreviewHandler : ContentHandler 
        protected override void GetItemMetadata(GetContentItemMetadataContext context)
            context.Metadata.EditorRouteValues = new RouteValueDictionary {
                {"Area", "BankrateInsurance.Preview"},
                {"Controller", "PreviewAdminController"},
                {"Action", "Preview"},
                {"postId", context.ContentItem.Id}  
I am attempting to just add this for blog posts to start but eventually will need it for pages as well. Am I going about this right? Is it possible? I have a Controller set up very similar to the ones in the AdminController under Contents and BlogPostAdminController.
Feb 6, 2013 at 9:15 PM
I went about this in a different way. I ended up submitting the form via ajax and went from there.