Esempio n. 1
0
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<button class='btn btn-primary'>{Button.Label}</button>",
                "Button",
                UIData);

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<img src='{Image.Value}' />",
                "Image",
                UIData);

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<input id='{Hidden.Id}' name='{Hidden.Name}' type='hidden' value='{Hidden.Value}'>",
                "Hidden",
                UIData);

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<div id='{Gravatar.Id}' style='width:{Gravatar.Width}' class='{Gravatar.Class}'></div>",
                "Gravatar",
                UIData);

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"
			<script>
				{Script.Code}
			</script>"            ,
                "Script",
                new
            {
                Code = UIData.Value
            });

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<div class='form-group'><label>{TextBox.Label}</label><input type='text' id='{TextBox.Id}' name='{TextBox.Name}' class='{TextBox.Class}' placeholder='{TextBox.Placeholder}' value='{TextBox.Value}' {TextBox.Attributes} /></div>",
                "TextBox",
                new {
                Id          = UIData.Id,
                Name        = UIData.Name,
                Label       = UIData.Label,
                Class       = UIData.Class,
                Placeholder = UIData.Placeholder,
                Value       = UIData.Value,
                Attributes  = UIData.CreateAttributesHtml()
            });

            return(html);
        }
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"<script>
					$(function() {
						$('#{Event.ParentId}').{Event.Name}(function(e) {
							 {Event.Callback}
						});
					});
				</script>"                ,
                "Event",
                new
            {
                Callback = UIData.Value,
                ParentId = Parent.Id,
                Name     = UIData.Name
            });

            return(html);
        }
Esempio n. 8
0
        internal override string CreateHtml()
        {
            var html = DynamicTextBuilder.Format(
                @"
	            <table           
	                {Grid.Id}
	                {Grid.Name}
	                class='grid'
	                {Grid.EnableSource}
	                data-controller='/{Grid.Controller}'
	                data-columns-title='{Grid.ColumnsTitle}' 
	                data-columns-width='{Grid.ColumnsWidth}'
					{Grid.ColumnsTemplate}          
	                {Grid.Deletable}
	                {Grid.Editable}
	                {Grid.Searchable}
	                {Grid.Paginable}
	                {Grid.Sortable}
	                {Grid.ShowInfo}
	            >
	            </table>"    ,
                "Grid",
                new
            {
                Id              = GetIdMarkup(),
                Name            = GetNameMarkup(),
                EnableSource    = GetEnableSource(),
                Controller      = GetControllerPath(),
                ColumnsTitle    = String.Join(", ", UIData.Columns.Select(c => c.UIData.Title)),
                ColumnsWidth    = String.Join(", ", UIData.Columns.Select(c => c.UIData.Width)),
                ColumnsTemplate = GetColumnsTemplateMarkup(),
                Deletable       = GetDeletableMarkup(),
                Editable        = GetEditableMarkup(),
                Searchable      = GetSearchableMarkup(),
                Paginable       = GetPaginableMarkup(),
                Sortable        = GetSortableMarkup(),
                ShowInfo        = GetShowInfoMarkup()
            });

            return(html);
        }
        internal override string CreateHtml()
        {
            var builder = new DynamicTextBuilder();

            builder.AddBindable(
                "Table",
                new
            {
                Id      = UIData.Id,
                Caption = UIData.Label
            });

            builder.Append("<table id='{Table.Id}'>");

            if (!String.IsNullOrEmpty(UIData.Label))
            {
                builder.Append("<caption>{Table.Caption}</caption>");
            }


            var rows     = UIData.Value as IEnumerable <TRow>;
            var rowsCont = rows.Count();

            if (rowsCont > 0)
            {
                var first      = rows.First();
                var rowType    = first.GetType();
                var properties = rowType.GetProperties();

                builder.Append("<thead><tr>");

                foreach (var p in properties)
                {
                    builder.Append("<th>");
                    builder.Append(p.Name);
                    builder.Append("</th>");
                }

                builder.Append("</tr></thead>");

                builder.Append("<tbody>");
                foreach (var r in rows)
                {
                    builder.Append("<tr>");

                    foreach (var p in properties)
                    {
                        builder.Append("<td>");
                        var v = p.GetValue(r);

                        if (v != null)
                        {
                            builder.Append(v.ToString());
                        }

                        builder.Append("</td>");
                    }

                    builder.Append("</tr>");
                }
            }

            builder.Append("</tbody>");
            builder.Append("</table>");

            return(builder.ToString());
        }