Example #1
0
        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()));
        }
Example #2
0
            public void AddCloseAll(HtmlHelper html)
            {
                const bool clearAll = true;
                var        closeAll = html.ControllerAction("", IdHelper.ClearHistoryAction, IdHelper.HomeName, IdHelper.ClearButtonClass, "", new RouteValueDictionary(new { clearAll })).ToString();

                AddElement(ToElement(closeAll));
            }
Example #3
0
            public void AddCloseThis(HtmlHelper html, UrlData nextEntry)
            {
                var closeThis     = html.ControllerAction("", IdHelper.ClearHistoryItemAction, IdHelper.HomeName, IdHelper.ClearItemButtonClass, "", AddPageData(nextEntry, new RouteValueDictionary(new { id = Id, nextId = nextEntry.Id }))).ToString();
                var closeThisElem = XDocument.Parse(closeThis).Element("form");

                AddElement(closeThisElem);
            }
Example #4
0
 public void AddCancel(HtmlHelper html, UrlData nextEntry) {
     var cancel = html.ControllerAction(MvcUi.Cancel, IdHelper.CancelAction, IdHelper.HomeName, IdHelper.CancelButtonClass, MvcUi.Cancel, AddPageData(nextEntry, new RouteValueDictionary(new { nextId = nextEntry.Id }))).ToString();
     Document = XDocument.Parse(cancel).Element("form").Document;
 }
Example #5
0
 public void AddCloseAll(HtmlHelper html) {
     const bool clearAll = true;
     var closeAll = html.ControllerAction("", IdHelper.ClearHistoryAction, IdHelper.HomeName, IdHelper.ClearButtonClass, "", new RouteValueDictionary(new { clearAll })).ToString();
     AddElement(ToElement(closeAll));
 }
Example #6
0
 public void AddCloseOthers(HtmlHelper html) {
     var closeOthers = html.ControllerAction("", IdHelper.ClearHistoryOthersAction, IdHelper.HomeName, IdHelper.ClearOthersButtonClass, "", AddPageData(this, new RouteValueDictionary(new { id = Id }))).ToString();
     AddElement(ToElement(closeOthers));
 }
Example #7
0
 public void AddCloseThis(HtmlHelper html, UrlData nextEntry) {
     var closeThis = html.ControllerAction("", IdHelper.ClearHistoryItemAction, IdHelper.HomeName, IdHelper.ClearItemButtonClass, "", AddPageData(nextEntry, new RouteValueDictionary(new { id = Id, nextId = nextEntry.Id }))).ToString();
     var closeThisElem = XDocument.Parse(closeThis).Element("form");
     AddElement(closeThisElem);
 }
Example #8
0
            public void AddCancel(HtmlHelper html, UrlData nextEntry)
            {
                var cancel = html.ControllerAction(MvcUi.Cancel, IdHelper.CancelAction, IdHelper.HomeName, IdHelper.CancelButtonClass, MvcUi.Cancel, AddPageData(nextEntry, new RouteValueDictionary(new { nextId = nextEntry.Id }))).ToString();

                Document = XDocument.Parse(cancel).Element("form").Document;
            }
Example #9
0
            public void AddCloseOthers(HtmlHelper html)
            {
                var closeOthers = html.ControllerAction("", IdHelper.ClearHistoryOthersAction, IdHelper.HomeName, IdHelper.ClearOthersButtonClass, "", AddPageData(this, new RouteValueDictionary(new { id = Id }))).ToString();

                AddElement(ToElement(closeOthers));
            }