Editor template not displaying for custom part

Topics: Writing modules
May 23, 2011 at 6:02 PM
Edited May 23, 2011 at 6:21 PM

I've been racking my brain trying to figure this one out.

I've got a custom module with a part called ProjectPart which I've got added to a custom ContentType called ProjectPage (it's the only part added to the content type).

When I try to create a new ProjectPage it doesn't show the editor template pushed from the driver.

I've confirmed that the driver's code is hit, it just doesn't seem to care about the TemplateName I've provided.

When I try to hit save or publish on the Content Item, it doesn't let me because the model doesn't validate.

I can provide more details.


Drivers > ProjectDriver.cs

 
        //GET
        protected override DriverResult Editor(ProjectPart part, dynamic shapeHelper)
        {
            var shape = ContentShape("Parts_Project_Edit", () => shapeHelper.EditorTemplate(
                   TemplateName: "Parts/Project",
                   Model: part,
                   Prefix: Prefix));
 
            return shape;
        }
 
        //POST
        protected override DriverResult Editor(ProjectPart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper)
        {
            updater.TryUpdateModel(part, Prefix, nullnull);
            return Editor(part, shapeHelper);
        }



Views > EditorTemplates > Parts > Project.cshtml

@model ProjectPart
 
<fieldset>
  <legend>Project Fields</legend>
            
  <div class="editor-label">
    @Html.LabelFor(model => model.Year)
  </div>
  <div class="editor-field">
    @Html.TextBoxFor(model => model.Year)
    @Html.ValidationMessageFor(model => model.Year)
  </div>
 
  <div class="editor-label">
    @Html.LabelFor(model => model.InvoiceNumber)
  </div>
  <div class="editor-field">
    @Html.TextBoxFor(model => model.InvoiceNumber)
    @Html.ValidationMessageFor(model => model.InvoiceNumber)
  </div>
            
</fieldset>
May 23, 2011 at 8:17 PM

Fixed...

My placement.info wasn't publishing.

May 25, 2011 at 8:57 AM

Related issue: I spent about 3 hours yesterday checking all but my placement.info file was correct!  Turns out I had the wrong name for the shape type in the placement file so I was getting a blank template with just a save button in the admin.  Thank you!