private static ElementDescriptor GetSelectionCollection(this HtmlHelper html, IObjectFacade collectionNakedObject, IObjectFacade targetNakedObject, string propertyName) {
            Func<IObjectFacade, string> linkFunc = item => WrapInDiv(html.ObjectIconAndDetailsLink(item.TitleString, IdConstants.ViewAction, item.Object) + " " +
                                                                           GetSubmitButton(IdConstants.SelectButtonClass, MvcUi.Select, IdConstants.SelectAction, new RouteValueDictionary(new { id = Encode(html.Facade().OidTranslator.GetOidTranslation(targetNakedObject)) }) { { propertyName, Encode(html.Facade().OidTranslator.GetOidTranslation(item)) } }), IdConstants.ObjectName).ToString();

            return new ElementDescriptor {
                TagType = "div",
                Value = html.CollectionTable(collectionNakedObject, linkFunc, x => false, null, false, false, true),
                Attributes = new RouteValueDictionary(new {
                    @class = IdConstants.CollectionListName
                })
            };
        }
        private static string GetCollectionAsTable(this HtmlHelper html, PropertyContext propertyContext) {
            var collectionNakedObject = propertyContext.GetValue(html.Facade());
            bool any = collectionNakedObject.ToEnumerable().Any();
            Func<IObjectFacade, string> linkFunc = item => html.Object(html.ObjectTitle(item).ToString(), IdConstants.ViewAction, item.Object).ToString();

            Func<IAssociationFacade, bool> filterFunc;
            Func<IAssociationFacade, int> orderFunc;
            bool withTitle;

            GetTableColumnInfo(propertyContext.Property, out filterFunc, out orderFunc, out withTitle);

            return (any ? html.GetCollectionDisplayLinks(propertyContext) : GetCollectionTitle(propertyContext, 0)) +
                   html.CollectionTable(collectionNakedObject, linkFunc, filterFunc, orderFunc, false, false, withTitle);
        }
 private static string GetCollectionAsList(this HtmlHelper html, PropertyContext propertyContext) {
     var collectionNakedObject = propertyContext.GetValue(html.Facade());
     bool any = collectionNakedObject.ToEnumerable().Any();
     Func<IObjectFacade, string> linkFunc = item => html.Object(html.ObjectTitle(item).ToString(), IdConstants.ViewAction, item.Object).ToString();
     return (any ? html.GetCollectionDisplayLinks(propertyContext) : GetCollectionTitle(propertyContext, 0)) +
            html.CollectionTable(collectionNakedObject, linkFunc, x => false, null, false, false, true);
 }
Пример #4
0
        private static ElementDescriptor GetSelectionCollection(this HtmlHelper html, INakedObject collectionNakedObject, INakedObject targetNakedObject, string propertyName) {
            Func<INakedObject, string> linkFunc = item => WrapInDiv(html.ObjectIconAndDetailsLink(item.TitleString(), IdHelper.ViewAction, item.Object) + " " +
                                                                    GetSubmitButton(IdHelper.SelectButtonClass, MvcUi.Select, IdHelper.SelectAction, new RouteValueDictionary(new {id = FrameworkHelper.GetObjectId(targetNakedObject)}) {{propertyName, FrameworkHelper.GetObjectId(item)}}), IdHelper.ObjectName).ToString();

            return new ElementDescriptor {
                TagType = "div",
                Value = html.CollectionTable(collectionNakedObject, linkFunc, x => false, null, false, false, true),
                Attributes = new RouteValueDictionary(new {
                    @class = IdHelper.CollectionListName
                })
            };
        }