Beispiel #1
0
        public static MvcHtmlString GridRepeater<T, S>(this HtmlHelper helper, TypeContext<T> tc, Expression<Func<T, MList<S>>> property, Action<GridRepeater> settingsModifier)
            where S : ModifiableEntity, IGridEntity
        {
            TypeContext<MList<S>> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
                return vo.OnSurroundLine(context.PropertyRoute, helper, tc, null);

            GridRepeater repeater = new GridRepeater(context.Type, context.UntypedValue, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(repeater, typeof(S).CleanType());

            Common.FireCommonTasks(repeater);

            if (settingsModifier != null)
                settingsModifier(repeater);

            var result = helper.InternalGridRepeater<S>(repeater);

            if (vo == null)
                return result;

            return vo.OnSurroundLine(repeater.PropertyRoute, helper, tc, result);
        }
Beispiel #2
0
        public static MvcHtmlString EntityStrip <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, MList <S> > > property, Action <EntityStrip> settingsModifier)
        {
            TypeContext <MList <S> > context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }

            EntityStrip es = new EntityStrip(context.Type, context.UntypedValue, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(es, typeof(S).CleanType());

            Common.FireCommonTasks(es);

            if (settingsModifier != null)
            {
                settingsModifier(es);
            }

            var result = helper.InternalEntityStrip <S>(es);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(es.PropertyRoute, helper, tc, result));
        }
Beispiel #3
0
        public static MvcHtmlString EntityCombo <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, S> > property, Action <EntityCombo> settingsModifier)
        {
            TypeContext <S> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }


            EntityCombo ec = new EntityCombo(typeof(S), context.Value, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(ec, ec.CleanRuntimeType ?? ec.Type.CleanType());

            Common.FireCommonTasks(ec);

            if (settingsModifier != null)
            {
                settingsModifier(ec);
            }

            var result = helper.InternalEntityCombo(ec);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(ec.PropertyRoute, helper, tc, result));
        }
        private static MvcHtmlString InternalTabRepeaterHeader<T>(this HtmlHelper helper, TypeElementContext<T> itemTC, EntityTabRepeater repeater)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("li", itemTC.Compose(EntityRepeaterKeys.RepeaterElement)).Let(h => itemTC.Index == 0 ? h.Class("active") : h)
                .Class("sf-repeater-element")))
            {
                using (sb.SurroundLine(new HtmlTag("a")
                    .Attr("href", "#" + itemTC.Compose(EntityBaseKeys.Entity))
                    .Attr("data-toggle", "tab")))
                {
                    sb.Add(new HtmlTag("span").SetInnerText(itemTC.Value.ToString()));

                    sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
                    sb.AddLine(helper.HiddenRuntimeInfo(itemTC));

                    if (repeater.Move)
                    {
                        sb.AddLine(EntityButtonHelper.MoveUpItem(helper, itemTC, repeater, btn: false, elementType: "span", isVertical: false));
                        sb.AddLine(EntityButtonHelper.MoveDownItem(helper, itemTC, repeater, btn: false, elementType: "span", isVertical: false));
                    }

                    if (repeater.Remove)
                        sb.AddLine(EntityButtonHelper.RemoveItem(helper, itemTC, repeater, btn: false, elementType: "span"));
                }

            }

            return sb.ToHtml();
        }
        private static MvcHtmlString InternalListDetailElement <T>(this HtmlHelper helper, HtmlStringBuilder sbOptions, TypeElementContext <T> itemTC, EntityListDetail listDetail)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
            sb.AddLine(helper.HiddenRuntimeInfo(itemTC));

            if (EntityBaseHelper.EmbeddedOrNew((Modifiable)(object)itemTC.Value))
            {
                sb.AddLine(EntityBaseHelper.RenderContent(helper, itemTC, RenderContentMode.ContentInInvisibleDiv, listDetail));
            }
            else if (itemTC.Value != null)
            {
                sb.Add(helper.Div(itemTC.Compose(EntityBaseKeys.Entity), null, "", new Dictionary <string, object> {
                    { "style", "display:none" }
                }));
            }

            sbOptions.Add(new HtmlTag("option")
                          .Id(itemTC.Compose(EntityBaseKeys.ToStr))
                          .Class("sf-entity-list-option")
                          .Let(a => itemTC.Index > 0 ? a : a.Attr("selected", "selected"))
                          .SetInnerText(itemTC.Value?.ToString())
                          .ToHtml(TagRenderMode.Normal));

            return(sb.ToHtml());
        }
        private static MvcHtmlString InternalEntityRepeater<T>(this HtmlHelper helper, EntityTabRepeater repeater)
        {
            if (!repeater.Visible || repeater.HideIfNull && repeater.UntypedValue == null)
                return MvcHtmlString.Empty;

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("fieldset").Id(repeater.Prefix).Class("sf-tab-repeater-field SF-control-container SF-avoid-child-errors")))
            {
                using (sb.SurroundLine(new HtmlTag("legend")))
                using (sb.SurroundLine(new HtmlTag("div", repeater.Compose("header"))))
                {
                    sb.AddLine(new HtmlTag("span").InnerHtml(repeater.LabelHtml ?? repeater.LabelText.FormatHtml()).ToHtml());

                    using (sb.SurroundLine(new HtmlTag("span", repeater.Compose("shownButton")).Class("pull-right")))
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, repeater, btn: false));
                        sb.AddLine(EntityButtonHelper.Find(helper, repeater, btn: false));
                    }
                }

                sb.AddLine(helper.Hidden(repeater.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div")))
                {
                    using (sb.SurroundLine(new HtmlTag("ul", repeater.Compose(EntityRepeaterKeys.ItemsContainer)).Class("nav nav-tabs")))
                    {
                        if (repeater.UntypedValue != null)
                        {
                            foreach (var itemTC in TypeContextUtilities.TypeElementContext((TypeContext<MList<T>>)repeater.Parent))
                                sb.Add(InternalTabRepeaterHeader(helper, itemTC, repeater));
                        }
                    }

                    using (sb.SurroundLine(new HtmlTag("div", repeater.Compose(EntityRepeaterKeys.TabsContainer)).Class("tab-content")))
                        if (repeater.UntypedValue != null)
                        {
                            foreach (var itemTC in TypeContextUtilities.TypeElementContext((TypeContext<MList<T>>)repeater.Parent))
                                using (sb.SurroundLine(new HtmlTag("div", itemTC.Compose(EntityBaseKeys.Entity)).Class("tab-pane")
                                    .Let(h => itemTC.Index == 0 ? h.Class("active") : h)))
                                    sb.Add(EntityBaseHelper.RenderContent(helper, itemTC, RenderContentMode.Content, repeater));
                        }
                }

                if (repeater.ElementType.IsEmbeddedEntity() && repeater.Create)
                {
                    T embedded = (T)(object)new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(typeof(T));
                    TypeElementContext<T> templateTC = new TypeElementContext<T>(embedded, (TypeContext)repeater.Parent, 0, null);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(repeater, EntityBaseHelper.RenderContent(helper, templateTC, RenderContentMode.Content, repeater), templateTC.Value.ToString()));
                }

                sb.AddLine(repeater.ConstructorScript(JsModule.Lines, "EntityTabRepeater"));
            }

            return sb.ToHtml();
        }
        static MvcHtmlString InternalListElement <T>(this HtmlHelper helper, HtmlStringBuilder sbOptions, TypeElementContext <T> itemTC, EntityList entityList)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();


            sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
            sb.AddLine(helper.HiddenRuntimeInfo(itemTC));

            if (entityList.IsVisible == null || entityList.IsVisible(itemTC))
            {
                if (EntityBaseHelper.EmbeddedOrNew((Modifiable)(object)itemTC.Value))
                {
                    sb.AddLine(EntityBaseHelper.RenderPopup(helper, itemTC, RenderPopupMode.PopupInDiv, entityList));
                }
                else if (itemTC.Value != null)
                {
                    sb.Add(helper.Div(itemTC.Compose(EntityBaseKeys.Entity), null, "",
                                      new Dictionary <string, object> {
                        { "style", "display:none" }, { "class", "sf-entity-list" }
                    }));
                }

                var optionTag = new HtmlTag("option")
                                .Id(itemTC.Compose(EntityBaseKeys.ToStr))
                                .Class("sf-entity-list-option")
                                .Let(a => itemTC.Index > 0 ? a : a.Attr("selected", "selected"))
                                .SetInnerText(itemTC.Value?.ToString());

                if (!EntityBaseHelper.EmbeddedOrNew((Modifiable)(object)itemTC.Value))
                {
                    PrimaryKey?idOrNull = null;
                    Type       type     = itemTC.Value.GetType();
                    if (type.IsLite())
                    {
                        idOrNull = ((Lite <IEntity>)itemTC.Value).IdOrNull;
                    }

                    if (type.IsEntity())
                    {
                        idOrNull = ((Entity)(object)itemTC.Value).IdOrNull;
                    }

                    optionTag.Attr("title", " ".CombineIfNotEmpty(itemTC.Value.GetType().CleanType().NiceName(), idOrNull));
                }

                sbOptions.Add(optionTag.ToHtml(TagRenderMode.Normal));
            }

            return(sb.ToHtml());
        }
Beispiel #8
0
        private static MvcHtmlString InternalRepeaterElement <T>(this HtmlHelper helper, TypeElementContext <T> itemTC, EntityRepeater repeater)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            if (repeater.IsVisible == null || repeater.IsVisible(itemTC))
            {
                using (sb.SurroundLine(new HtmlTag("fieldset", itemTC.Compose(EntityRepeaterKeys.RepeaterElement)).Class("sf-repeater-element")))
                {
                    using (sb.SurroundLine(new HtmlTag("legend")))
                    {
                        if (repeater.Remove)
                        {
                            sb.AddLine(EntityButtonHelper.RemoveItem(helper, itemTC, repeater, btn: false, elementType: "a"));
                        }

                        if (repeater.Move)
                        {
                            sb.AddLine(EntityButtonHelper.MoveUpItem(helper, itemTC, repeater, btn: false, elementType: "a", isVertical: true));
                            sb.AddLine(EntityButtonHelper.MoveDownItem(helper, itemTC, repeater, btn: false, elementType: "a", isVertical: true));
                        }
                    }

                    sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
                    sb.AddLine(helper.HiddenRuntimeInfo(itemTC));

                    sb.AddLine(EntityBaseHelper.RenderContent(helper, itemTC, RenderContentMode.ContentInVisibleDiv, repeater));
                }
            }
            else
            {
                using (sb.SurroundLine(new HtmlTag("fieldset", itemTC.Compose(EntityRepeaterKeys.RepeaterElement)).Class("sf-repeater-element hidden")))
                {
                    sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
                    sb.AddLine(helper.HiddenRuntimeInfo(itemTC));
                }
            }

            return(sb.ToHtml());
        }
Beispiel #9
0
        public static MvcHtmlString EntityLine <T, S>(this HtmlHelper helper, TypeContext <T> tc, Expression <Func <T, S> > property, Action <EntityLine> settingsModifier)
        {
            TypeContext <S> context = Common.WalkExpression(tc, property);

            var vo = tc.ViewOverrides;

            if (vo != null && !vo.IsVisible(context.PropertyRoute))
            {
                return(vo.OnSurroundLine(context.PropertyRoute, helper, tc, null));
            }

            EntityLine el = new EntityLine(typeof(S), context.Value, context, null, context.PropertyRoute);

            EntityBaseHelper.ConfigureEntityBase(el, el.CleanRuntimeType ?? el.Type.CleanType());

            if (el.Implementations == null || el.Implementations.Value.IsByAll)
            {
                el.Autocomplete = false;
            }

            Common.FireCommonTasks(el);

            if (settingsModifier != null)
            {
                settingsModifier(el);
            }

            var result = helper.InternalEntityLine(el);

            if (vo == null)
            {
                return(result);
            }

            return(vo.OnSurroundLine(el.PropertyRoute, helper, tc, result));
        }
Beispiel #10
0
        private static MvcHtmlString InternalEntityListCheckbox <T>(this HtmlHelper helper, EntityListCheckbox entityListCheckBox)
        {
            if (!entityListCheckBox.Visible || entityListCheckBox.HideIfNull && entityListCheckBox.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }

            var elementType = entityListCheckBox.Type.ElementType();

            if (!elementType.IsIEntity() && !elementType.IsLite())
            {
                throw new InvalidOperationException("EntityCombo can only be done for an identifiable or a lite, not for {0}".FormatWith(elementType.CleanType()));
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("fieldset", entityListCheckBox.Prefix).Class("SF-repeater-field SF-control-container SF-avoid-child-errors")))
            {
                sb.AddLine(helper.Hidden(entityListCheckBox.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div", entityListCheckBox.Compose("hidden")).Class("hide")))
                {
                }

                using (sb.SurroundLine(new HtmlTag("legend")))
                    using (sb.SurroundLine(new HtmlTag("div", entityListCheckBox.Compose("header"))))
                    {
                        sb.AddLine(new HtmlTag("span").InnerHtml(entityListCheckBox.LabelHtml ?? entityListCheckBox.LabelText.FormatHtml()).ToHtml());

                        using (sb.SurroundLine(new HtmlTag("span", entityListCheckBox.Compose("shownButton")).Class("pull-right")))
                        {
                            sb.AddLine(EntityButtonHelper.Create(helper, entityListCheckBox, btn: false));
                            sb.AddLine(EntityButtonHelper.Find(helper, entityListCheckBox, btn: false));
                        }
                    }

                using (sb.SurroundLine(new HtmlTag("div").Id(entityListCheckBox.Compose(EntityRepeaterKeys.ItemsContainer)).Attr("style", GetStyle(entityListCheckBox))))
                {
                    IEnumerable <Lite <IEntity> > data = entityListCheckBox.Data ?? AutocompleteUtils.FindAllLite(entityListCheckBox.Implementations.Value).OrderBy(a => a.ToString());

                    if (entityListCheckBox.UntypedValue != null)
                    {
                        var already = TypeContextUtilities.TypeElementContext((TypeContext <MList <T> >)entityListCheckBox.Parent).ToDictionary(a => AsLite(a.Value), "repeated elements");

                        List <Lite <IEntity> > liteList = data.Except(already.Keys).ToList();

                        List <T> typedList = typeof(Lite <IEntity>).IsAssignableFrom(typeof(T)) ? liteList.Cast <T>().ToList(): Database.RetrieveFromListOfLite(liteList).Cast <T>().ToList();

                        var extra = typedList.Select((e, i) => new TypeElementContext <T>(e, (TypeContext)entityListCheckBox.Parent, i + already.Count, null)).ToDictionary(a => AsLite(a.Value), "repeated elements");

                        foreach (var lite in data)
                        {
                            sb.Add(InternalRepeaterElement(helper, already.TryGetC(lite) ?? extra.GetOrThrow(lite), entityListCheckBox, already.ContainsKey(lite), lite));
                        }
                    }
                }

                if (entityListCheckBox.ElementType.IsEmbeddedEntity() && entityListCheckBox.Create)
                {
                    T embedded = (T)(object)new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(typeof(T));
                    TypeElementContext <T> templateTC = new TypeElementContext <T>(embedded, (TypeContext)entityListCheckBox.Parent, 0, null);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityListCheckBox, EntityBaseHelper.RenderContent(helper, templateTC, RenderContentMode.Content, entityListCheckBox), null));
                }

                sb.AddLine(entityListCheckBox.ConstructorScript(JsModule.Lines, "EntityListCheckbox"));
            }

            return(sb.ToHtml());
        }
Beispiel #11
0
        private static MvcHtmlString InternalRepeaterElement <T>(this HtmlHelper helper, TypeElementContext <T> itemTC, EntityListCheckbox entityListCheckBox, bool isChecked, Lite <IEntity> lite)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            var label = new HtmlTag("label", itemTC.Compose(EntityRepeaterKeys.RepeaterElement)).Class("sf-checkbox-element");

            entityListCheckBox.CustomizeLabel?.Invoke(label, lite);

            using (sb.SurroundLine(label))
            {
                if (EntityBaseHelper.EmbeddedOrNew((Modifiable)(object)itemTC.Value))
                {
                    sb.AddLine(EntityBaseHelper.RenderPopup(helper, itemTC, RenderPopupMode.PopupInDiv, entityListCheckBox));
                }
                else if (itemTC.Value != null)
                {
                    sb.Add(helper.Div(itemTC.Compose(EntityBaseKeys.Entity), null, "",
                                      new Dictionary <string, object> {
                        { "style", "display:none" }, { "class", "sf-entity-list" }
                    }));
                }

                var cb = new HtmlTag("input")
                         .Attr("type", "checkbox")
                         .Attr("name", itemTC.Compose(EntityBaseKeys.RuntimeInfo))
                         .Attr("value", itemTC.RuntimeInfo()?.ToString());

                if (isChecked)
                {
                    cb.Attr("checked", "checked");
                }

                if (entityListCheckBox.ReadOnly)
                {
                    cb.Attr("disabled", "disabled");
                }

                entityListCheckBox.CustomizeCheckBox?.Invoke(cb, lite);

                sb.AddLine(cb);

                if (lite != null && (entityListCheckBox.Navigate || entityListCheckBox.View))
                {
                    var dic = new Dictionary <string, object>
                    {
                        { "target", "_blank" }
                    };

                    sb.AddLine(
                        helper.Href(itemTC.Compose(EntityBaseKeys.Link),
                                    lite.ToString(),
                                    lite.IdOrNull == null ? null : Navigator.NavigateRoute(lite),
                                    lite.ToString(), "sf-entitStrip-link", dic));
                }
                else
                {
                    sb.AddLine(
                        helper.Span(itemTC.Compose(EntityBaseKeys.Link),
                                    itemTC.UntypedValue.ToString() ?? " ", "sf-entitStrip-link"));
                }
            }

            return(sb.ToHtml());
        }
Beispiel #12
0
        private static MvcHtmlString PrintValueField(HtmlHelper helper, Context parent, FilterOption filterOption)
        {
            var implementations = filterOption.Token.GetImplementations();

            if (filterOption.Token.Type.IsLite())
            {
                Lite <IEntity> lite = (Lite <IEntity>)Common.Convert(filterOption.Value, filterOption.Token.Type);
                if (lite != null && string.IsNullOrEmpty(lite.ToString()))
                {
                    Database.FillToString(lite);
                }

                Type cleanType = Lite.Extract(filterOption.Token.Type);
                if (EntityKindCache.IsLowPopulation(cleanType) && !cleanType.IsInterface && !implementations.Value.IsByAll)
                {
                    EntityCombo ec = new EntityCombo(filterOption.Token.Type, lite, parent, "", filterOption.Token.GetPropertyRoute())
                    {
                        Implementations = implementations.Value,
                    };
                    EntityBaseHelper.ConfigureEntityButtons(ec, filterOption.Token.Type.CleanType());
                    ec.FormGroupStyle = FormGroupStyle.None;
                    ec.Create         = false;
                    ec.ReadOnly       = filterOption.Frozen;
                    return(EntityComboHelper.InternalEntityCombo(helper, ec));
                }
                else
                {
                    EntityLine el = new EntityLine(filterOption.Token.Type, lite, parent, "", filterOption.Token.GetPropertyRoute())
                    {
                        Implementations = implementations.Value,
                    };

                    if (el.Implementations.Value.IsByAll)
                    {
                        el.Autocomplete = false;
                    }

                    EntityBaseHelper.ConfigureEntityButtons(el, filterOption.Token.Type.CleanType());
                    el.FormGroupStyle = FormGroupStyle.None;
                    el.Create         = false;
                    el.ReadOnly       = filterOption.Frozen;

                    return(EntityLineHelper.InternalEntityLine(helper, el));
                }
            }
            else if (filterOption.Token.Type.IsEmbeddedEntity())
            {
                EmbeddedEntity lite = (EmbeddedEntity)Common.Convert(filterOption.Value, filterOption.Token.Type);
                EntityLine     el   = new EntityLine(filterOption.Token.Type, lite, parent, "", filterOption.Token.GetPropertyRoute())
                {
                    Implementations = null,
                    Autocomplete    = false,
                };
                EntityBaseHelper.ConfigureEntityButtons(el, filterOption.Token.Type.CleanType());
                el.FormGroupStyle = FormGroupStyle.None;
                el.Create         = false;
                el.ReadOnly       = filterOption.Frozen;

                return(EntityLineHelper.InternalEntityLine(helper, el));
            }
            else
            {
                var vl = new ValueLine(filterOption.Token.Type, filterOption.Value, parent, "", filterOption.Token.GetPropertyRoute())
                {
                    FormGroupStyle = FormGroupStyle.None,
                    ReadOnly       = filterOption.Frozen,
                    Format         = filterOption.Token.Format,
                    UnitText       = filterOption.Token.Unit,
                };

                if (filterOption.Token.Type.UnNullify().IsEnum)
                {
                    vl.EnumComboItems = ValueLine.CreateComboItems(EnumEntity.GetValues(vl.Type.UnNullify()), vl.UntypedValue == null || vl.Type.IsNullable());
                }

                return(ValueLineHelper.ValueLine(helper, vl));
            }

            throw new InvalidOperationException("Invalid filter for type {0}".FormatWith(filterOption.Token.Type.Name));
        }
Beispiel #13
0
        internal static MvcHtmlString InternalEntityLine(this HtmlHelper helper, EntityLine entityLine)
        {
            if (!entityLine.Visible || (entityLine.HideIfNull && entityLine.UntypedValue == null))
            {
                return(MvcHtmlString.Empty);
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("div", entityLine.Prefix).Class("SF-entity-line SF-control-container")))
            {
                sb.AddLine(helper.HiddenRuntimeInfo(entityLine));

                using (sb.SurroundLine(new HtmlTag("div", entityLine.Compose("hidden")).Class("hide")))
                {
                    if (entityLine.UntypedValue != null)
                    {
                        sb.AddLine(AutocompleteTextBox(helper, entityLine));
                        sb.AddLine(EntityButtonHelper.Create(helper, entityLine, btn: true));
                        sb.AddLine(EntityButtonHelper.Find(helper, entityLine, btn: true));
                    }
                    else
                    {
                        sb.AddLine(LinkOrSpan(helper, entityLine));
                        sb.AddLine(EntityButtonHelper.View(helper, entityLine, btn: true));
                        sb.AddLine(EntityButtonHelper.Remove(helper, entityLine, btn: true));
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div", entityLine.Compose("inputGroup")).Class("input-group")))
                {
                    if (entityLine.UntypedValue == null)
                    {
                        sb.AddLine(AutocompleteTextBox(helper, entityLine));
                    }
                    else
                    {
                        sb.AddLine(LinkOrSpan(helper, entityLine));
                    }

                    using (sb.SurroundLine(new HtmlTag("span", entityLine.Compose("shownButton")).Class("input-group-btn")))
                    {
                        if (entityLine.UntypedValue == null)
                        {
                            sb.AddLine(EntityButtonHelper.Create(helper, entityLine, btn: true));
                            sb.AddLine(EntityButtonHelper.Find(helper, entityLine, btn: true));
                        }
                        else
                        {
                            sb.AddLine(EntityButtonHelper.View(helper, entityLine, btn: true));
                            sb.AddLine(EntityButtonHelper.Remove(helper, entityLine, btn: true));
                        }
                    }
                }

                if (entityLine.Type.IsEmbeddedEntity() && entityLine.Create)
                {
                    EmbeddedEntity embedded   = (EmbeddedEntity) new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(entityLine.Type.CleanType());
                    TypeContext    templateTC = ((TypeContext)entityLine.Parent).Clone(embedded);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityLine, EntityBaseHelper.RenderPopup(helper, templateTC, RenderPopupMode.Popup, entityLine, isTemplate: true), null));
                }

                if (EntityBaseHelper.EmbeddedOrNew((Modifiable)entityLine.UntypedValue))
                {
                    sb.AddLine(EntityBaseHelper.RenderPopup(helper, (TypeContext)entityLine.Parent, RenderPopupMode.PopupInDiv, entityLine));
                }


                sb.AddLine(entityLine.ConstructorScript(JsModule.Lines, "EntityLine"));
            }

            return(helper.FormGroup(entityLine, entityLine.Prefix, entityLine.LabelHtml ?? entityLine.LabelText.FormatHtml(), sb.ToHtml()));
        }
Beispiel #14
0
        private static MvcHtmlString InternalEntityStrip <T>(this HtmlHelper helper, EntityStrip entityStrip)
        {
            if (!entityStrip.Visible || entityStrip.HideIfNull && entityStrip.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }


            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("div", entityStrip.Prefix).Class("SF-entity-strip SF-control-container")))
            {
                sb.AddLine(helper.Hidden(entityStrip.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div", entityStrip.Compose("hidden")).Class("hide")))
                {
                }

                using (sb.SurroundLine(new HtmlTag("ul", entityStrip.Compose(EntityStripKeys.ItemsContainer))
                                       .Class("sf-strip").Class(entityStrip.Vertical ? "sf-strip-vertical" : "sf-strip-horizontal")))
                {
                    if (entityStrip.UntypedValue != null)
                    {
                        foreach (var itemTC in TypeContextUtilities.TypeElementContext((TypeContext <MList <T> >)entityStrip.Parent))
                        {
                            sb.Add(InternalStripElement(helper, itemTC, entityStrip));
                        }
                    }

                    using (sb.SurroundLine(new HtmlTag("li").Class("sf-strip-input input-group")))
                    {
                        if (entityStrip.Autocomplete)
                        {
                            var htmlAttr = new Dictionary <string, object>
                            {
                                { "class", "sf-entity-autocomplete" },
                                { "autocomplete", "off" },
                            };

                            sb.AddLine(helper.TextBox(
                                           entityStrip.Compose(EntityBaseKeys.ToStr),
                                           null,
                                           htmlAttr));
                        }

                        using (sb.SurroundLine(new HtmlTag("span", entityStrip.Compose("shownButton"))))
                        {
                            sb.AddLine(EntityButtonHelper.Create(helper, entityStrip, btn: false));
                            sb.AddLine(EntityButtonHelper.Find(helper, entityStrip, btn: false));
                        }
                    }
                }

                if (entityStrip.ElementType.IsEmbeddedEntity() && entityStrip.Create)
                {
                    T embeddedEntity = (T)(object)new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(typeof(T));
                    TypeElementContext <T> templateTC = new TypeElementContext <T>(embeddedEntity, (TypeContext)entityStrip.Parent, 0, null);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityStrip, EntityBaseHelper.RenderPopup(helper, templateTC, RenderPopupMode.Popup, entityStrip, isTemplate: true), null));
                }

                sb.AddLine(entityStrip.ConstructorScript(JsModule.Lines, "EntityStrip"));
            }

            return(helper.FormGroup(entityStrip, entityStrip.Prefix, entityStrip.LabelHtml ?? entityStrip.LabelText.FormatHtml(), sb.ToHtml()));
        }
Beispiel #15
0
        internal static MvcHtmlString InternalEntityCombo(this HtmlHelper helper, EntityCombo entityCombo)
        {
            if (!entityCombo.Visible || entityCombo.HideIfNull && entityCombo.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }

            if (!entityCombo.Type.IsIEntity() && !entityCombo.Type.IsLite())
            {
                throw new InvalidOperationException("EntityCombo can only be done for an identifiable or a lite, not for {0}".FormatWith(entityCombo.Type.CleanType()));
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("div", entityCombo.Prefix).Class("SF-entity-combo SF-control-container")))
            {
                sb.AddLine(helper.HiddenRuntimeInfo(entityCombo));

                using (sb.SurroundLine(new HtmlTag("div", entityCombo.Compose("hidden")).Class("hide")))
                {
                    if (entityCombo.UntypedValue != null)
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, entityCombo, btn: true));
                        sb.AddLine(EntityButtonHelper.Find(helper, entityCombo, btn: true));
                    }
                    else
                    {
                        sb.AddLine(EntityButtonHelper.View(helper, entityCombo, btn: true));
                        sb.AddLine(EntityButtonHelper.Remove(helper, entityCombo, btn: true));
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div", entityCombo.Compose("inputGroup")).Class("input-group")))
                {
                    if (entityCombo.ReadOnly)
                    {
                        sb.AddLine(helper.FormControlStatic(entityCombo, entityCombo.Compose(EntityBaseKeys.ToStr), entityCombo.UntypedValue?.ToString()));
                    }
                    else
                    {
                        sb.AddLine(DropDownList(helper, entityCombo));
                    }

                    using (sb.SurroundLine(new HtmlTag("span", entityCombo.Compose("shownButton")).Class("input-group-btn")))
                    {
                        if (entityCombo.UntypedValue == null)
                        {
                            sb.AddLine(EntityButtonHelper.Create(helper, entityCombo, btn: true));
                            sb.AddLine(EntityButtonHelper.Find(helper, entityCombo, btn: true));
                        }
                        else
                        {
                            sb.AddLine(EntityButtonHelper.View(helper, entityCombo, btn: true));
                            sb.AddLine(EntityButtonHelper.Remove(helper, entityCombo, btn: true));
                        }
                    }
                }

                if (entityCombo.Type.IsEmbeddedEntity() && entityCombo.Create)
                {
                    EmbeddedEntity embedded   = (EmbeddedEntity) new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(entityCombo.Type.CleanType());
                    TypeContext    templateTC = ((TypeContext)entityCombo.Parent).Clone(embedded);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityCombo, EntityBaseHelper.RenderPopup(helper, templateTC, RenderPopupMode.Popup, entityCombo, isTemplate: true), null));
                }

                if (EntityBaseHelper.EmbeddedOrNew((Modifiable)entityCombo.UntypedValue))
                {
                    sb.AddLine(EntityBaseHelper.RenderPopup(helper, (TypeContext)entityCombo.Parent, RenderPopupMode.PopupInDiv, entityCombo));
                }

                sb.AddLine(entityCombo.ConstructorScript(JsModule.Lines, "EntityCombo"));
            }

            return(helper.FormGroup(entityCombo, entityCombo.Prefix, entityCombo.LabelHtml ?? entityCombo.LabelText.FormatHtml(), sb.ToHtml()));
        }
        internal static MvcHtmlString InternalEntityDetail(this HtmlHelper helper, EntityDetail entityDetail)
        {
            if (!entityDetail.Visible || entityDetail.HideIfNull && entityDetail.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("fieldset", entityDetail.Prefix).Class("SF-entity-line-details SF-control-container")))
            {
                sb.AddLine(helper.HiddenRuntimeInfo(entityDetail));

                using (sb.SurroundLine(new HtmlTag("div", entityDetail.Compose("hidden")).Class("hide")))
                {
                    if (entityDetail.UntypedValue != null)
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, entityDetail, btn: false));
                        sb.AddLine(EntityButtonHelper.Find(helper, entityDetail, btn: false));
                    }
                    else
                    {
                        sb.AddLine(EntityButtonHelper.Remove(helper, entityDetail, btn: false));
                    }
                }

                using (sb.SurroundLine(new HtmlTag("legend")))
                    using (sb.SurroundLine(new HtmlTag("div", entityDetail.Compose("header"))))
                    {
                        sb.AddLine(new HtmlTag("span").InnerHtml(entityDetail.LabelHtml ?? entityDetail.LabelText.FormatHtml()).ToHtml());

                        using (sb.SurroundLine(new HtmlTag("span", entityDetail.Compose("shownButton")).Class("pull-right")))
                        {
                            if (entityDetail.UntypedValue == null)
                            {
                                sb.AddLine(EntityButtonHelper.Create(helper, entityDetail, btn: false));
                                sb.AddLine(EntityButtonHelper.Find(helper, entityDetail, btn: false));
                            }
                            else
                            {
                                sb.AddLine(EntityButtonHelper.Remove(helper, entityDetail, btn: false));
                            }
                        }
                    }

                using (sb.SurroundLine(new HtmlTag("div", entityDetail.Compose(EntityBaseKeys.Detail))))
                {
                    if (entityDetail.UntypedValue != null)
                    {
                        sb.AddLine(EntityBaseHelper.RenderContent(helper, (TypeContext)entityDetail.Parent, RenderContentMode.Content, entityDetail));
                    }
                }

                if (entityDetail.Type.IsEmbeddedEntity() && entityDetail.Create)
                {
                    EmbeddedEntity embedded   = (EmbeddedEntity) new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(entityDetail.Type.CleanType());
                    TypeContext    templateTC = ((TypeContext)entityDetail.Parent).Clone(embedded);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityDetail, EntityBaseHelper.RenderContent(helper, templateTC, RenderContentMode.Content, entityDetail), null));
                }

                sb.AddLine(entityDetail.ConstructorScript(JsModule.Lines, "EntityDetail"));
            }

            return(sb.ToHtml());
        }
        private static MvcHtmlString InternalEntityListDetail <T>(this HtmlHelper helper, EntityListDetail listDetail)
        {
            if (!listDetail.Visible || listDetail.HideIfNull && listDetail.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("div", listDetail.Prefix).Class("SF-entity-list-detail SF-control-container")))
            {
                sb.AddLine(helper.Hidden(listDetail.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div", listDetail.Compose("hidden")).Class("hide")))
                {
                }

                HtmlStringBuilder sbSelect = new HtmlStringBuilder();

                var sbSelectContainer = new HtmlTag("select").Attr("size", "6").Class("form-control")
                                        .IdName(listDetail.Compose(EntityListBaseKeys.List));

                if (listDetail.ListHtmlProps.Any())
                {
                    sbSelectContainer.Attrs(listDetail.ListHtmlProps);
                }

                using (sbSelect.SurroundLine(sbSelectContainer))
                {
                    if (listDetail.UntypedValue != null)
                    {
                        foreach (var itemTC in TypeContextUtilities.TypeElementContext((TypeContext <MList <T> >)listDetail.Parent))
                        {
                            sb.Add(InternalListDetailElement(helper, sbSelect, itemTC, listDetail));
                        }
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div", listDetail.Compose("inputGroup")).Class("input-group")))
                {
                    sb.Add(sbSelect.ToHtml());

                    using (sb.SurroundLine(new HtmlTag("span", listDetail.Compose("shownButton")).Class("input-group-btn btn-group-vertical")))
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, listDetail, btn: true));
                        sb.AddLine(EntityButtonHelper.Find(helper, listDetail, btn: true));
                        sb.AddLine(EntityButtonHelper.Remove(helper, listDetail, btn: true));
                        sb.AddLine(EntityButtonHelper.MoveUp(helper, listDetail, btn: true));
                        sb.AddLine(EntityButtonHelper.MoveDown(helper, listDetail, btn: true));
                    }
                }

                if (listDetail.ElementType.IsEmbeddedEntity() && listDetail.Create)
                {
                    T embedded = (T)(object)new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(typeof(T));
                    TypeElementContext <T> templateTC = new TypeElementContext <T>(embedded, (TypeContext)listDetail.Parent, 0, null);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(listDetail, EntityBaseHelper.RenderContent(helper, templateTC, RenderContentMode.Content, listDetail), templateTC.Value.ToString()));
                }

                sb.AddLine(listDetail.ConstructorScript(JsModule.Lines, "EntityListDetail"));
            }

            var formGroup = helper.FormGroup(listDetail, listDetail.Prefix, listDetail.LabelHtml ?? listDetail.LabelText.FormatHtml(), sb.ToHtml());

            if (listDetail.DetailDiv != listDetail.Compose(EntityBaseKeys.Detail))
            {
                return(formGroup);
            }

            HtmlStringBuilder sb2 = new HtmlStringBuilder();

            sb2.Add(formGroup);
            using (sb2.SurroundLine(new HtmlTag("fieldset")))
                sb2.AddLine(helper.Div(listDetail.DetailDiv, null, "SF-entity-list-detail-detaildiv"));

            return(sb2.ToHtml());
        }
        private static MvcHtmlString InternalEntityList <T>(this HtmlHelper helper, EntityList entityList)
        {
            if (!entityList.Visible || entityList.HideIfNull && entityList.UntypedValue == null)
            {
                return(MvcHtmlString.Empty);
            }

            HtmlStringBuilder sb = new HtmlStringBuilder();

            using (sb.SurroundLine(new HtmlTag("div", entityList.Prefix).Class("SF-entity-list SF-control-container")))
            {
                sb.AddLine(helper.Hidden(entityList.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div", entityList.Compose("hidden")).Class("hide")))
                {
                }

                HtmlStringBuilder sbSelect = new HtmlStringBuilder();

                var sbSelectContainer = new HtmlTag("select").Attr("size", "6").Class("form-control")
                                        .IdName(entityList.Compose(EntityListBaseKeys.List));

                if (entityList.ListHtmlProps.Any())
                {
                    sbSelectContainer.Attrs(entityList.ListHtmlProps);
                }

                using (sbSelect.SurroundLine(sbSelectContainer))
                {
                    if (entityList.UntypedValue != null)
                    {
                        foreach (var itemTC in TypeContextUtilities.TypeElementContext((TypeContext <MList <T> >)entityList.Parent))
                        {
                            sb.Add(InternalListElement(helper, sbSelect, itemTC, entityList));
                        }
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div", entityList.Compose("inputGroup")).Class("input-group")))
                {
                    sb.Add(sbSelect.ToHtml());

                    using (sb.SurroundLine(new HtmlTag("span", entityList.Compose("shownButton")).Class("input-group-btn btn-group-vertical")))
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, entityList, btn: true));
                        sb.AddLine(EntityButtonHelper.Find(helper, entityList, btn: true));
                        sb.AddLine(EntityButtonHelper.View(helper, entityList, btn: true));
                        sb.AddLine(EntityButtonHelper.Remove(helper, entityList, btn: true));
                        sb.AddLine(EntityButtonHelper.MoveUp(helper, entityList, btn: true));
                        sb.AddLine(EntityButtonHelper.MoveDown(helper, entityList, btn: true));
                    }
                }

                if (entityList.ElementType.IsEmbeddedEntity() && entityList.Create)
                {
                    T embedded = (T)(object)new ConstructorContext(helper.ViewContext.Controller).ConstructUntyped(typeof(T));
                    TypeElementContext <T> templateTC = new TypeElementContext <T>(embedded, (TypeContext)entityList.Parent, 0, null);
                    sb.AddLine(EntityBaseHelper.EmbeddedTemplate(entityList, EntityBaseHelper.RenderPopup(helper, templateTC, RenderPopupMode.Popup, entityList, isTemplate: true), null));
                }
                sb.AddLine(entityList.ConstructorScript(JsModule.Lines, "EntityList"));
            }

            return(helper.FormGroup(entityList, entityList.Prefix, entityList.LabelHtml ?? entityList.LabelText.FormatHtml(), sb.ToHtml()));
        }
Beispiel #19
0
        private static MvcHtmlString InternalStripElement <T>(this HtmlHelper helper, TypeElementContext <T> itemTC, EntityStrip entityStrip)
        {
            HtmlStringBuilder sb = new HtmlStringBuilder();

            if (entityStrip.IsVisible == null || entityStrip.IsVisible(itemTC))
            {
                using (sb.SurroundLine(new HtmlTag("li").IdName(itemTC.Compose(EntityStripKeys.StripElement)).Class("sf-strip-element input-group")))
                {
                    var lite = (itemTC.UntypedValue as Lite <IEntity>) ?? (itemTC.UntypedValue as IEntity)?.Let(i => i.ToLite(i.IsNew));

                    if (lite != null && (entityStrip.Navigate || entityStrip.View))
                    {
                        var dic = new Dictionary <string, object>
                        {
                            { "onclick", entityStrip.SFControlThen("viewItem_click(\"" + itemTC.Prefix + "\", event)") }
                        };

                        sb.AddLine(
                            helper.Href(itemTC.Compose(EntityBaseKeys.Link),
                                        lite.ToString(),
                                        "#",
                                        lite.ToString(), "sf-entitStrip-link", dic));
                    }
                    else
                    {
                        sb.AddLine(
                            helper.Span(itemTC.Compose(EntityBaseKeys.Link),
                                        itemTC.UntypedValue.ToString() ?? " ", "sf-entitStrip-link"));
                    }

                    sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
                    sb.AddLine(helper.HiddenRuntimeInfo(itemTC));

                    if (EntityBaseHelper.EmbeddedOrNew((Modifiable)(object)itemTC.Value))
                    {
                        sb.AddLine(EntityBaseHelper.RenderPopup(helper, itemTC, RenderPopupMode.PopupInDiv, entityStrip));
                    }

                    using (sb.SurroundLine(new HtmlTag("span")))
                    {
                        if (entityStrip.Move)
                        {
                            sb.AddLine(EntityButtonHelper.MoveUpItem(helper, itemTC, entityStrip, btn: false, elementType: "a", isVertical: entityStrip.Vertical));
                            sb.AddLine(EntityButtonHelper.MoveDownItem(helper, itemTC, entityStrip, btn: false, elementType: "a", isVertical: entityStrip.Vertical));
                        }

                        if (entityStrip.View)
                        {
                            sb.AddLine(EntityButtonHelper.ViewItem(helper, itemTC, entityStrip, btn: false));
                        }

                        if (entityStrip.Remove)
                        {
                            sb.AddLine(EntityButtonHelper.RemoveItem(helper, itemTC, entityStrip, btn: false));
                        }
                    }
                }
            }
            else
            {
                using (sb.SurroundLine(new HtmlTag("li").IdName(itemTC.Compose(EntityStripKeys.StripElement)).Class("sf-strip-element input-group hidden")))
                {
                    sb.AddLine(EntityBaseHelper.WriteIndex(helper, itemTC));
                    sb.AddLine(helper.HiddenRuntimeInfo(itemTC));
                }
            }

            return(sb.ToHtml());
        }
Beispiel #20
0
        private static MvcHtmlString InternalGridRepeater<T>(this HtmlHelper helper, GridRepeater repeater)
            where T : ModifiableEntity, IGridEntity
        {
            if (!repeater.Visible || repeater.HideIfNull && repeater.UntypedValue == null)
                return MvcHtmlString.Empty;

            HtmlStringBuilder sb = new HtmlStringBuilder();
            using (sb.SurroundLine(new HtmlTag("fieldset", repeater.Prefix).Class("SF-grid-repeater-field SF-control-container")))
            {
                sb.AddLine(helper.Hidden(repeater.Compose(EntityListBaseKeys.ListPresent), ""));

                using (sb.SurroundLine(new HtmlTag("div", repeater.Compose("hidden")).Class("hide")))
                {
                }

                using (sb.SurroundLine(new HtmlTag("legend")))
                using (sb.SurroundLine(new HtmlTag("div", repeater.Compose("header"))))
                {
                    sb.AddLine(new HtmlTag("span").InnerHtml(repeater.LabelHtml ?? repeater.LabelText.FormatHtml()).ToHtml());

                    using (sb.SurroundLine(new HtmlTag("span", repeater.Compose("shownButton")).Class("pull-right")))
                    {
                        sb.AddLine(EntityButtonHelper.Create(helper, repeater, btn: false));
                        sb.AddLine(EntityButtonHelper.Find(helper, repeater, btn: false));
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div").Class("row rule")))
                {
                    for (int i = 0; i < 12; i++)
                    {
                        using (sb.SurroundLine(new HtmlTag("div").Class("col-sm-1")))
                        using (sb.SurroundLine(new HtmlTag("div").Class("ruleItem")))
                        {
                        }
                    }
                }

                using (sb.SurroundLine(new HtmlTag("div").Id(repeater.Compose(EntityRepeaterKeys.ItemsContainer))))
                {
                    if (repeater.UntypedValue != null)
                    {
                        foreach (var gr in TypeContextUtilities.TypeElementContext((TypeContext<MList<T>>)repeater.Parent).GroupBy(a => a.Value.Row).OrderBy(a => a.Key))
                        {
                            using (sb.SurroundLine(new HtmlTag("div").Class("row separator-row")))
                            {
                            }

                            using (sb.SurroundLine(new HtmlTag("div").Class("row items-row")))
                            {
                                var lastEnd = 0;
                                foreach (var itemTC in gr.OrderBy(a => a.Value.StartColumn))
                                {
                                    helper.ViewData[LastEnd] = lastEnd;
                                    sb.Add(EntityBaseHelper.RenderContent(helper, itemTC, RenderContentMode.Content, repeater));
                                    lastEnd = itemTC.Value.StartColumn + itemTC.Value.Columns;
                                }
                            }
                        }

                        helper.ViewData.Remove("lastEnd");
                    }

                    using (sb.SurroundLine(new HtmlTag("div").Class("row separator-row")))
                    {
                    }
                }

                sb.AddLine(repeater.ConstructorScript(DashboardClient.GridRepeater, "GridRepeater"));
            }

            return sb.ToHtml();
        }