I built a module to create an UrgentIssue content type. That went well and is all working. Now I've been trying for the past few days to build a widget that will show the current ones (based on some criteria to only pull active and approved items) as a bar
in the Messages zone.
I was initially trying to copy how the blog module shows recent posts as it seemed comparable, but I can't get it to show my data. I created a contentPart and contentPartRecord for the widget. I have a driver with a display method that pulls the list of
current items (an Enumerable of UrgentIssueParts). The blog module driver also had some code to build a shape and return it from the method, which I attempted to adapt. There is a view (Widget-CurrentUrgentIssues.cshtml) that is displaying on my page.
The problem is that I can't get my list of UrgentIssues to get passed into the view. Model.ContentItems is always empty.
What is the recommended way of building a widget like this?
Here is my Display method:
protected override DriverResult Display(CurrentUrgentIssuesPart part, string displayType, dynamic shapeHelper)
var issues = _contentManager.Query(VersionOptions.Published, "UrgentIssue")
.Where<UrgentIssuePartRecord>(x => x.IsApproved == true && x.IsActive == true)
.OrderByDescending(cr => cr.CreatedUtc).List<UrgentIssuePart>();
//.Select(ci => ci.As<UrgentIssuePart>());
//.Where(cr => cr.Container == )))))
var list = shapeHelper.List();
list.AddRange(issues.Select(i => _contentManager.BuildDisplay(i, "Summary")));
var issueList = shapeHelper.Parts_UrgentIssue_List(
() => shapeHelper.Widget__CurrentUrgentIssues(
<h2>all current issues this @Model.ContentItems.Count</h2>
@*@foreach (var issue in Model.ContentItems)