Content editor in Dashboard not showing editor fields

Topics: Customizing Orchard, Troubleshooting, Writing modules
Jan 6, 2012 at 6:21 AM

I created a custom content type with only two fields: Name, and BasicInfo. They are string fields and i see the table and columns are in my db after updating the module via Migrations.cs. I defined the Drivers and Handler exactly as this page describes: http://docs.orchardproject.net/Documentation/Creating-a-module-with-a-simple-text-editor. I also created /Views/Parts/ShoePart.cshtml and /Views/EditorTemplates/Parts/ShoePart.cshtml . 

I verified in the dashboard that the Shoe content type contains the "ShoePart". But when I click "Create new Shoe", it takes me to ~/Admin/Contents/Create/Shoe , which is a page that just has a "Save" button and nothing else. I expected to see two text entry fields for my part's two properties. 

Editor method in the Driver:

        protected override DriverResult Editor(ShoePart part, dynamic shapeHelper)
        {
            return ContentShape(
                "Parts_Shoe_Edit"
                , () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/Shoe"
                    , Model: part
                    , Prefix: Prefix
                )
            );
        }
The Model and record:

    public class ShoePartRecord : ContentPartRecord
    {
        public virtual string Name { get; set; }
        public virtual string BasicInfo { get; set; }
    }



    public class ShoePart : ContentPart
    {
        [Required]
        public string Name
        {
            get { return Record.Name; }
            set { Record.Name = value; }
        }
        [Required]
        public string BasicInfo
        {
            get { return Record.BasicInfo; }
            set { Record.BasicInfo = value; }
        }
    }

Migration:
            SchemaBuilder.CreateTable(
                "ShoePartRecord"
                , t =>
                    t.ContentPartRecord()
                    .Column("Name", DbType.String)
                    .Column("BasicInfo", DbType.String)
            );
            ContentDefinitionManager.AlterPartDefinition("ShoePart", b => b.Attachable());

            ContentDefinitionManager.AlterTypeDefinition("Shoe", cfg => cfg
                .WithPart("ShoePart")
                .Creatable()
            );

And ~/Views/EditorTemplates/Parts/Shoe.cshtml:
@model myproj.Models.ShoePart
<fieldset  class="profile-fields">
    <legend></legend>
    @Html.LabelFor(m => m.Name, T("Name:"))
    @Html.EditorFor(m => m.Name)
    @Html.ValidationMessageFor(m => m.Name, "*")
    <br />
    @Html.LabelFor(m => m.BasicInfo, T("Basic Info:"))
    @Html.EditorFor(m => m.BasicInfo)
    @Html.ValidationMessageFor(m => m.BasicInfo, "*")
</fieldset>

Hopefully I'm just missing something simple. 

Coordinator
Jan 6, 2012 at 7:42 AM

You forgot placement.

Jan 6, 2012 at 12:40 PM

Ah, it was a typo in placement.info. Thanks!