Domanda

When I am in the N2 management / admin interface, if I click on a node in the tree, by default it shows the output of that page. I can show the edit screen for that node by right clicking the node and clicking 'Edit'. Can I get it to show the edit screen for that node by just clicking the node? Is there some setting I can change in web.config?

È stato utile?

Soluzione

So the comment that I left on the question above doesn't really answer the question (it works only for the root node). However, pretty much everything in N2 is pluggable, so you can use the dependency injection framework to replace the code that generates URLs in the edit interface with your own code as follows:

using N2.Configuration;
using N2.Edit;
using N2.Engine;
using N2.Web;

namespace MyWebsite
{
    [Service(typeof(IEditUrlManager), Replaces = typeof(EditUrlManager))]
    public class MyEditUrlManager : EditUrlManager
    {
        public MyEditUrlManager(IUrlParser parser, EditSection config)
            : base(parser, config)
        {

        }

        public override string GetPreviewUrl(N2.ContentItem selectedItem)
        {
            return GetEditExistingItemUrl(selectedItem);
        }
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top