public static MvcHtmlString History(this HtmlHelper html, int count, object domainObject = null, bool clearAll = false) { if (domainObject != null && !(domainObject is FindViewModel)) { string url = html.Object(html.ObjectTitle(domainObject).ToString(), IdHelper.ViewAction, domainObject).ToString(); html.ViewContext.HttpContext.Session.AddToCache(html.Framework(), domainObject, url, ObjectCache.ObjectFlag.BreadCrumb); } List <string> urls = html.ViewContext.HttpContext.Session.AllCachedUrls(ObjectCache.ObjectFlag.BreadCrumb).ToList(); int sizeCache = urls.Count(); int skip = sizeCache > count ? sizeCache - count : 0; urls = urls.Skip(skip).ToList(); var tag = new TagBuilder("div"); tag.AddCssClass(IdHelper.HistoryContainerName); foreach (string url in urls) { tag.InnerHtml += url; } if (urls.Any()) { tag.InnerHtml += html.ControllerAction(MvcUi.Clear, IdHelper.ClearHistoryAction, IdHelper.HomeName, IdHelper.ClearButtonClass, "", new RouteValueDictionary(new { clearAll })); } return(MvcHtmlString.Create(tag.ToString())); }
private static MvcHtmlString GetStandalone(HtmlHelper html, IObjectFacade collectionNakedObject, Func<IAssociationFacade, bool> filter, Func<IAssociationFacade, int> order, TagBuilder tag, bool withTitle) { Func<IObjectFacade, string> linkFunc = item => html.Object(html.ObjectTitle(item).ToString(), IdConstants.ViewAction, item.Object).ToString(); string menu = collectionNakedObject.Specification.IsQueryable ? html.MenuOnTransient(collectionNakedObject.GetDomainObject()).ToString() : ""; string id = collectionNakedObject.Oid == null ? "" : Encode(html.Facade().OidTranslator.GetOidTranslation(collectionNakedObject)); // can only be standalone and hence page if we have an id tag.InnerHtml += html.CollectionTable(collectionNakedObject, linkFunc, filter, order, !String.IsNullOrEmpty(id), collectionNakedObject.Specification.IsQueryable, withTitle); return html.WrapInForm(IdConstants.EditObjectAction, html.Facade().GetObjectTypeShortName(collectionNakedObject.GetDomainObject()), menu + tag, IdConstants.ActionName, new RouteValueDictionary(new { id })); }
private static MvcHtmlString GetStandalone(HtmlHelper html, INakedObject collectionNakedObject, Func<INakedObjectAssociation, bool> filter, Func<INakedObjectAssociation, int> order, TagBuilder tag, bool withTitle) { Func<INakedObject, string> linkFunc = item => html.Object(html.ObjectTitle(item).ToString(), IdHelper.ViewAction, item.Object).ToString(); string menu = collectionNakedObject.Specification.IsQueryable ? html.MenuOnTransient(collectionNakedObject.Object).ToString() : ""; string id = collectionNakedObject.Oid == null ? "" : FrameworkHelper.GetObjectId(collectionNakedObject); // can only be standalone and hence page if we have an id tag.InnerHtml += html.CollectionTable(collectionNakedObject, linkFunc, filter, order, !string.IsNullOrEmpty(id), collectionNakedObject.Specification.IsQueryable, withTitle); return html.WrapInForm(IdHelper.EditObjectAction, FrameworkHelper.GetObjectTypeName(collectionNakedObject.Object), menu + tag, IdHelper.ActionName, new RouteValueDictionary(new {id})); }