Help with Shape rendering

Topics: Troubleshooting
Sep 9, 2011 at 11:14 AM

Hi, this problem is really driving me up the wall, I'm sure it's something very simple that I'm doing wrong but I cannot for the life of me figure it out!

I have a widget, which is rendering a very simple view, here is the code for the Driver and View

Driver:

public class CoursePickerDriver : ContentPartDriver<CoursePickerPart>
{
    private IOrchardServices Services;

    public CoursePickerDriver(IOrchardServices services)
    {
        Services = services;
    }

    protected override DriverResult Display(CoursePickerPart part, string displayType, dynamic shapeHelper)
    {
        CoursePickerWidgetViewModel model = new CoursePickerWidgetViewModel();

        CoursePickerContext context = Context(Services.WorkContext.HttpContext.Request.Path);

        string linkUrl = String.Format("/CoursePicker/{0}#content", context);

        return ContentShape("Parts_CoursePicker", () => shapeHelper.Parts_CoursePicker(LinkUrl: linkUrl));
    }

    private CoursePickerContext Context(string slug)
    {
        foreach (string contextString in Enum.GetNames(typeof(CoursePickerContext)))
        {
            if (slug.ToLowerInvariant().Contains(contextString.ToLowerInvariant()))
            {
                return (CoursePickerContext)Enum.Parse(typeof(CoursePickerContext), contextString);
            }
        }

        return CoursePickerContext.Undergraduate;
    }
}

View:

@{
    Script.Require("jQuery");
    Script.Require("jQueryUI_Tabs");
    Script.Require("Spa.CoursePicker");

    HtmlHelper.UnobtrusiveJavaScriptEnabled = true;
    Script.Require("UnobtrusiveAjax");
}
<a href="@Model.LinkUrl" id="nyroCoursePicker" title="CoursePicker">Course Picker</a>

The view file is under the module directory in the folder path ModuleRoot/Views/Parts/CoursePicker.cshtml.

The driver code is definately being run, I can break into it.

The widget is partially displaying, I can see the title of it on the page.

The view however, simply refuses to render. I am at my wits end. Can somebody cleverer than me let me know what I'm doing wrong here!

If you can't see anything wrong with what I've done, some pointers as to how I can debug this issue would be helpful. I've had a brief look into the Orchard code but was frankly slightly overwhelmed.

Thanks in advance.

 

Regards,

Charlie

Developer
Sep 9, 2011 at 11:22 AM

change ModuleRoot/Views/Parts/CoursePicker.cshtml

to

ModuleRoot/Views/Parts.CoursePicker.cshtml


Also have you setup your placement.info file? This will determine if it gets rendered or not..

Sep 9, 2011 at 11:32 AM

You legend. I knew it would be something simple! Placement.info it was. Feel like a right berk now :)

Many Thanks

Charlie