Editor template not getting diaplayed

Topics: Customizing Orchard, Writing modules
Mar 16, 2012 at 7:44 AM

I have just about started developing a new module using the Create Content Part example. My issues is the COntentPart fields are not getting diaplayed in the ContentItem. I have kept a break point in the Driver methods and none of them are getting hit. ANy help much apreciated.

Thanks.

 

I have created ContentPart like below

Model:
namespace Conversations.Models
{
    public class ConversationsRecord:ContentPartRecord
    {
        public virtual Int32 CircleId { get; set; }
    }


    public class ConversationsPart : ContentPart {

        public Int32 CircleId {
            get { return Record.CircleId; }
            set { Record.CircleId = value; }
        }
    }
}

Handler

namespace Conversations.Handlers
{
    public class ConversationHandler : ContentHandler {
        public ConversationHandler(IRepository repository) {
            Filters.Add(StorageFilter.For(repository));
        }
    }
}
Driver
namespace Conversations
{
    public class ConversationsDriver:ContentPartDriver
    {
        protected override DriverResult Display(
            ConversationsPart part, string displayType, dynamic shapeHelper)
        {
            return ContentShape("Parts_Conversations", () => shapeHelper.Parts_Map(
                CircleId:part.CircleId));
        }

        //GET
        protected override DriverResult Editor(
            ConversationsPart part, dynamic shapeHelper)
        {

            return ContentShape("Parts_Conversations_Edit",
                () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/Conversations",
                    Model: part,
                    Prefix: Prefix));
        }
        //POST
        protected override DriverResult Editor(
            ConversationsPart part, IUpdateModel updater, dynamic shapeHelper)
        {

            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);
        }
    }
    
}

Editor Template

@model  Conversations.Models.ConversationsPart
<fieldset>
    <legend>CircleId</legend>
    
@Html.LabelFor(model => model.CircleId):
@Html.TextBoxFor(model => model.CircleId)
</fieldset>

Mar 16, 2012 at 10:52 AM
Edited Mar 16, 2012 at 10:53 AM

Your driver should be for your part, so you have to specify which part the driver is for:

public class ConversationsDriver : ContentPartDriver<ConversationsPart>