Пример #1
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults) {
            int columns = Convert.ToInt32(context.State.Columns);
            bool horizontal = Convert.ToString(context.State.Alignment) != "vertical"; 
            
            string gridTag = Convert.ToString(context.State.GridTag);
            string gridClass = Convert.ToString(context.State.GridClass);
            if (!String.IsNullOrEmpty(gridClass)) gridClass += " ";
            gridClass += "projector-layout projector-grid-layout";
            string gridId = Convert.ToString(context.State.GridId);

            string rowTag = Convert.ToString(context.State.RowTag);
            string rowClass = Convert.ToString(context.State.RowClass);

            string cellTag = Convert.ToString(context.State.CellTag);
            string cellClass = Convert.ToString(context.State.CellClass);

            string emptyCell = Convert.ToString(context.State.EmptyCell);

            IEnumerable<dynamic> shapes =
               context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                   ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                   : layoutComponentResults.Select(x => x.Properties);

            return Shape.Grid(Id: gridId, Horizontal: horizontal, Columns: columns, Items: shapes, Tag: gridTag, Classes: new[] { gridClass }, RowTag: rowTag, RowClasses: new[] { rowClass }, CellTag: cellTag, CellClasses: new[] { cellClass }, EmptyCell: emptyCell);
        }
Пример #2
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults) {
            string containerTag = context.State.ContainerTag;
            string containerId = context.State.ContainerId;
            string containerClass = context.State.ContainerClass;

            string itemTag = context.State.ItemTag;
            string itemClass = context.State.ItemClass;

            string prepend = context.State.Prepend;
            string append = context.State.Append;
            string separator = context.State.Separator;

            IEnumerable<dynamic> shapes =
               context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                   ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                   : layoutComponentResults.Select(x => x.Properties);

            return Shape.Raw(
                Id: containerId, 
                Items: shapes, 
                Tag: containerTag,
                Classes: new [] { containerClass },
                ItemTag: itemTag,
                ItemClasses: new [] { itemClass },
                Prepend: prepend,
                Append: append,
                Separator: separator
                );
        }
Пример #3
0
        public LocalizedString DisplayLayout(LayoutContext context) {
            string columns = context.State.Columns;
            bool horizontal = Convert.ToString(context.State.Alignment) != "vertical";

            return horizontal
                       ? T("{0} columns grid", columns)
                       : T("{0} lines grid", columns);
        }
Пример #4
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults)
        {
            string shapeType = context.State.ShapeType;

            dynamic shape = ((IShapeFactory) Shape).Create(shapeType);
            shape.ContentItems = layoutComponentResults.Select(x => x.ContentItem);
            shape.BuildShapes= (Func<IEnumerable<dynamic>>) (() => context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                   ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                   : layoutComponentResults.Select(x => x.Properties));

            return shape;
        }
Пример #5
0
        public LocalizedString DisplayLayout(LayoutContext context) {
            string order = context.State.Order;

            switch(order) {
                case "ordered":
                    return T("Ordered Html List");
                case "unordered":
                    return T("Unordered Html List");
                default:
                    throw new ArgumentOutOfRangeException("order");
            }
        }
Пример #6
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults) {
            int columns = Convert.ToInt32(context.State.Columns);
            bool horizontal = Convert.ToString(context.State.Alignment) != "vertical"; 
            string rowClass = context.State.RowClass;
            string gridClass = context.State.GridClass;
            string gridId = context.State.GridId;

            IEnumerable<dynamic> shapes =
               context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                   ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                   : layoutComponentResults.Select(x => x.Properties);

            return Shape.Grid(Id: gridId, Horizontal: horizontal, Columns: columns, Items: shapes, Classes: new [] { gridClass }, RowClasses: new [] { rowClass });
        }
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults)
        {
            string outerDivClass = context.State.outerDivClass;
            string outerDivId = context.State.OuterDivID;
            string innerDivClass = context.State.InnerDicClass;
            string firstItemClass = context.State.FirstItemClass;
            string itemClass = context.State.ItemClass;

            IEnumerable<dynamic> shapes =
               context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                   ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                   : layoutComponentResults.Select(x => x.Properties);

            return Shape.Carousel(Id: outerDivId, Items: shapes, OuterClasses: new[] { outerDivClass },
                    InnerClasses: new[] {innerDivClass}, FirstItemClasses: new[] {firstItemClass}, ItemClasses: new[] {itemClass});
        }
Пример #8
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults)
        {
            int columns = Convert.ToInt32(context.State.Columns.Value);
            bool horizontal = Convert.ToString(context.State.Alignment) != "vertical";
            string rowClass = context.State.RowClass;
            string gridClass = context.State.GridClass;
            string gridId = context.State.GridId;

            string contentType = string.Empty;
            if (layoutComponentResults.Any())
                contentType = layoutComponentResults.First().ContentItem.TypeDefinition.Name;

            IEnumerable<dynamic> shapes =
                context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
                    ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
                    : layoutComponentResults.Select(x => x.Properties);

            return Shape.ngGrid(Items: shapes, ContentType: contentType);
        }
Пример #9
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults) {
            string order = context.State.Order;
            string itemClass = context.State.ItemClass;
            string listClass = context.State.ListClass;
            string listId = context.State.ListId;

            string listTag = order == "ordered" ? "ol" : "ul";

            IEnumerable<dynamic> shapes;
            if(context.LayoutRecord.Display == (int) LayoutRecord.Displays.Content) {
                shapes = layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType));
            }
            else {
                shapes = layoutComponentResults.Select(x => x.Properties);
            }

            var classes = String.IsNullOrEmpty(listClass) ? Enumerable.Empty<string>() : new[] { listClass };
            var itemClasses = String.IsNullOrEmpty(itemClass) ? Enumerable.Empty<string>() : new[] { itemClass };

            return Shape.List(Id: listId, Items: shapes, Tag: listTag, Classes: classes, ItemClasses: itemClasses);
        }
Пример #10
0
        public dynamic RenderLayout(LayoutContext context, IEnumerable<LayoutComponentResult> layoutComponentResults)
        {
            int columns = 2;//Convert.ToInt32(context.State.Columns);
            bool horizontal = Convert.ToString(context.State.Alignment) != "vertical";
            string rowClass = context.State.RowClass;
            string gridClass = context.State.GridClass;
            string gridId = context.State.GridId;

            IEnumerable<dynamic> shapes =
               //context.LayoutRecord.Display == (int)LayoutRecord.Displays.Content
               //    ? layoutComponentResults.Select(x => _contentManager.BuildDisplay(x.ContentItem, context.LayoutRecord.DisplayType))
               layoutComponentResults.Select(x => x.Properties);

            //ClayJsonConverter converter = new ClayJsonConverter();

            //StringBuilder sb = new StringBuilder();
            //StringWriter sw = new StringWriter(sb);
            //using (JsonWriter jsonWriter = new JsonTextWriter(sw))
            //{
            //    converter.WriteJson(jsonWriter, shapes, new JsonSerializer() {  });
            //}

            return Shape.JsonList(Id: gridId, Horizontal: horizontal, Columns: columns, Items: shapes, Classes: new[] { gridClass }, RowClasses: new[] { rowClass });
        }
Пример #11
0
 public LocalizedString DisplayLayout(LayoutContext context) {
     return T("Renders content with custom separators.");
 }
 public LocalizedString DisplayLayout(LayoutContext context) {
     return T("Renders markup for use with Bootstrap Carousel.");
 }
Пример #13
0
 public LocalizedString DisplayLayout(LayoutContext context)
 {
     return T("Renders content in a {0} layout", context.State.ShapeType.ToString());
 }