private static MvcHtmlString GetEditButtonIfRequired(this HtmlHelper html, bool anyEditableFields, IObjectFacade inlineNakedObject) {
     if (anyEditableFields &&
         !inlineNakedObject.Specification.IsAlwaysImmutable &&
         !inlineNakedObject.Specification.IsImmutableOncePersisted &&
         !inlineNakedObject.Specification.IsComplexType) {
         return html.ControllerAction(MvcUi.Edit, IdConstants.EditObjectAction, IdConstants.EditButtonClass, inlineNakedObject.Object);
     }
     return new MvcHtmlString("");
 }
示例#2
0
 private static MvcHtmlString GetEditButtonIfRequired(this HtmlHelper html, bool anyEditableFields, INakedObject inlineNakedObject) {
     if (anyEditableFields &&
         !inlineNakedObject.Specification.IsAlwaysImmutable() &&
         !inlineNakedObject.Specification.IsImmutableOncePersisted() &&
         !inlineNakedObject.Specification.ContainsFacet<IComplexTypeFacet>()) {
         return html.ControllerAction(MvcUi.Edit, IdHelper.EditObjectAction, IdHelper.EditButtonClass, inlineNakedObject.Object);
     }
     return new MvcHtmlString("");
 }
示例#3
-1
        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(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());
        }