internal static IWidget CreateWidget(WidgetContext ctx) { var ident = ctx.Entity as Entity; if (ident == null || ident.IsNew) { return(null); } List <QuickLink> quicklinks = LinksClient.GetForEntity(ident.ToLiteFat(), ctx.PartialViewName, ctx.Prefix, null, ctx.Url); if (quicklinks == null || quicklinks.Count == 0) { return(null); } return(new Widget { Id = TypeContextUtilities.Compose(ctx.Prefix, "quicklinksWidget"), Class = "sf-quicklinks", Title = QuickLinkMessage.Quicklinks.NiceToString(), IconClass = "glyphicon glyphicon-star", Text = quicklinks.Count.ToString(), Items = quicklinks.OrderBy(a => a.Order).Cast <IMenuItem>().ToList(), Active = true, }); }
internal static MenuItemBlock ContextualItemsHelper_GetContextualItemsForLite(SelectedItemsMenuContext ctx) { if (ctx.Lites.IsNullOrEmpty() || ctx.Lites.Count > 1) { return(null); } List <QuickLink> quickLinks = LinksClient.GetForEntity(ctx.Lites[0], null, ctx.Prefix, ctx.QueryName, ctx.Url); if (quickLinks.IsNullOrEmpty()) { return(null); } return(new MenuItemBlock { Header = QuickLinkMessage.Quicklinks.NiceToString(), Items = quickLinks }); }