Exemple #1
0
        internal static string RenderWithEditContext(DynamicEntity parent, DynamicEntity subItem, string cbFieldName,  Guid? newGuid = null, IInPageEditingSystem edit = null)
        {
            if (edit == null)
                edit = new InPageEditingHelper(parent.SxcInstance);

            var attribs = edit.ContextAttributes(parent, field: cbFieldName, newGuid: newGuid);
            var inner = (subItem == null) ? "": Render(parent.SxcInstance.ContentBlock, subItem.Entity).ToString();
            var cbClasses = edit.Enabled ? WrapperSingleItem : "";
            return string.Format(WrapperTemplate, new object[] { cbClasses, attribs, inner});
        }
Exemple #2
0
        internal static string RenderListWithContext(DynamicEntity parent, string fieldName, IInPageEditingSystem edit = null)
        {
            object objFound;
            var innerBuilder = new StringBuilder();
            var found = parent.TryGetMember(fieldName, out objFound);
            if (found)
            {
                var itms = objFound as IList<DynamicEntity>;
                if(itms != null)
                    foreach (var cb in itms)
                        innerBuilder.Append(Render(cb.SxcInstance.ContentBlock, cb.Entity));
            }

            // create edit object if missing...to re-use in the wh
            if (edit == null)
                edit = new InPageEditingHelper(parent.SxcInstance);

            return string.Format(WrapperTemplate, new object[]
            {
                edit.Enabled ? WrapperMultiItems : "",
                edit.ContextAttributes(parent, field: fieldName),
                innerBuilder
            });
        }
Exemple #3
0
        internal static string RenderListWithContext(DynamicEntity parent, string fieldName, IInPageEditingSystem edit = null)
        {
            var innerBuilder = new StringBuilder();
            var found        = parent.TryGetMember(fieldName, out var objFound);

            if (found)
            {
                if (objFound is IList <DynamicEntity> itms)
                {
                    foreach (var cb in itms)
                    {
                        innerBuilder.Append(Render(cb.SxcInstance.ContentBlock, cb.Entity, parent.SxcInstance.Log));
                    }
                }
            }

            // create edit object if missing...to re-use in the wh
            if (edit == null)
            {
                edit = new InPageEditingHelper(parent.SxcInstance, parent.SxcInstance.Log);
            }

            return(string.Format(WrapperTemplate, new object[]
            {
                edit.Enabled?WrapperMultiItems: "",
                edit.ContextAttributes(parent, field: fieldName),
                innerBuilder
            }));
        }
Exemple #4
0
        private const string WrapperSingleItem = WrapperMultiItems + " show-placeholder single-item"; // enables a placeholder when empty, and limits one entry


        internal static string RenderWithEditContext(DynamicEntity parent, DynamicEntity subItem, string cbFieldName, Guid?newGuid = null, IInPageEditingSystem edit = null)
        {
            if (edit == null)
            {
                edit = new InPageEditingHelper(parent.SxcInstance, parent.SxcInstance.Log);
            }

            var attribs   = edit.ContextAttributes(parent, field: cbFieldName, newGuid: newGuid);
            var inner     = subItem == null ? "": Render(parent.SxcInstance.ContentBlock, subItem.Entity, parent.SxcInstance.Log).ToString();
            var cbClasses = edit.Enabled ? WrapperSingleItem : "";

            return(string.Format(WrapperTemplate, new object[] { cbClasses, attribs, inner }));
        }