private IJsonArrayBuilder GetGridSections(IJsonArraySyntax arraySyntax) { var builder = new FluentJsonBuilder(); return(arraySyntax.WithItems(_gridSections.Select(gridSection => builder.CreateNew() .WithProperty("grid", gridSection.LayoutColumnCount) .WithArray("rows", stx => GetGridSectionRows(gridSection, stx)) .Build()).ToArray())); }
private IJsonArrayBuilder GetGridSectionRows(GridSection section, IJsonArraySyntax arraySyntax) { var builder = new FluentJsonBuilder(); return(arraySyntax.WithItems(section.Rows.Select(gridRow => builder.CreateNew() .WithProperty("id", GetComponentId()) .WithProperty("name", gridRow.LayoutName) .WithProperty("hasConfig", gridRow.HasConfig) .WithObject("config", GetDictionaryObject(gridRow.Config)) .WithObject("styles", GetDictionaryObject(gridRow.Styles)) .WithArray("areas", stx => GetGridRowColumns(gridRow, stx)) .Build()).ToArray())); }
private IJsonArrayBuilder GetGridColumnControls(GridColumn column, IJsonArraySyntax arraySyntax) { var builder = new FluentJsonBuilder(); return(arraySyntax.WithItems(column.Controls.Select(control => builder.CreateNew() .WithObject("value", stx => stx.CreateNew() .WithProperty("id", GetComponentId()) .WithProperty("dtgeContentTypeAlias", control.Alias) .WithObject("value", control.Value)) .WithObject("editor", stx => stx.CreateNew() .WithProperty("alias", control.Alias)) .WithProperty("active", true) .Build()).ToArray())); }
private IJsonArrayBuilder GetGridRowColumns(GridRow row, IJsonArraySyntax arraySyntax) { var builder = new FluentJsonBuilder(); return(arraySyntax.WithItems(row.Columns.Select(gridRowColumn => builder.CreateNew() .WithProperty("grid", 12 / row.Columns.Count) .WithProperty("allowAll", true) // TODO: parametrize this value later //.WithArray("allowed", new JArray()) // TODO: parametrize this value later .WithProperty("hasConfig", gridRowColumn.HasConfig) .WithObject("config", GetDictionaryObject(gridRowColumn.Config)) .WithObject("styles", GetDictionaryObject(gridRowColumn.Styles)) .WithArray("controls", stx => GetGridColumnControls(gridRowColumn, stx)) .Build()).ToArray())); }