예제 #1
0
        public IHtmlContent Render(TModel entity)
        {
            string   id    = new Identifier().Value;
            DateTime?value = default;
            string   name  = this.expression.GetPropertyName();

            if (entity != null)
            {
                value = this.modelExpression.Compile()(entity);
            }

            var attributes = new TagAttributeList
            {
                { Attr.Type, "text" },
                { Attr.Class, "form-control datetimepicker" },
                { Attr.Name, name },
                { Attr.Placeholder, this.lable },
                { Attr.Value, value.Value },
                { Attr.Id, id },
            };

            var input = TagHelper.Create(Tag.input, attributes);
            var span  = TagHelper.Create(Tag.span, new TagAttribute(Attr.Class, "input-group-addon"), new MaterialIcon("access_time").Html);

            span.PostElement.SetHtmlContent(input);
            return(TagHelper.Div("input-group", span));
        }
예제 #2
0
        public IHtmlContent Render(TModel entity)
        {
            string   id         = new Identifier().Value;
            DateTime?value      = default;
            string   name       = this.expression.GetPropertyName();
            var      attributes = new TagAttributeList
            {
                { Attr.Type, "text" },
                { Attr.Class, $"form-control {this.Type.ToString().ToLower()}picker" },
                { Attr.Name, name },
                { Attr.Id, id },
                { Attr.AutoComplete, "off" },
            };

            if (entity != null)
            {
                value = this.modelExpression.Compile()(entity);
                if (value.HasValue && value != null)
                {
                    attributes.Add(Attr.Value, value);
                }
            }

            var label = TagHelper.Create(Tag.label, new TagAttribute(Attr.Class, "control-label"), this.lable);
            var input = TagHelper.Create(Tag.input, attributes);
            var span  = TagHelper.Create(Tag.span, new TagAttribute(Attr.Class, "form-control-feedback"), new MaterialIcon("done").Html); //  clear

            return(TagHelper.Div("form-group label-floating has-success", label, input, span));                                           // has-error
        }
예제 #3
0
        public string ToHtml()
        {
            TagAttributeList attributes = new TagAttributeList()
            {
                new TagAttribute(Attr.Type, "checkbox"),
                new TagAttribute(Attr.Name, "optionsCheckboxes"),
            };

            if (this.isChecked)
            {
                attributes.Add(new TagAttribute(Attr.Checked));
            }

            if (this.isDisabled)
            {
                attributes.Add(new TagAttribute(Attr.Disabled));
            }

            var input = TagHelper.SelfClosingTag(Tag.input, attributes);

            input.PostElement.SetContent(this.text);
            var label = TagHelper.Create(Tag.label, input);
            var div   = TagHelper.Div("checkbox", label);

            return(TagHelper.ToHtml(div));
        }
예제 #4
0
        protected override IHtmlContent Body()
        {
            var b = new TagAttributeList()
            {
                { Attr.Class, "page-header header-filter" },
                { Attr.DataParallax, "true" },
                { Attr.Style, "background-image: url('/img/examples/city.jpg');" },
            };
            var list = DapperExtension.FindAll <Icon>().OrderBy(o => o.Sort).ToList();
            TagAttributeList attributes = new TagAttributeList
            {
                { Attr.Class, "nav nav-pills nav-pills-icons" },
                { Attr.Role, "tablist" },
            };
            var ul = TagHelper.Create(Tag.ul, attributes, HtmlIcons.Generate(list));
            TagAttributeList attributes1 = new TagAttributeList
            {
                { Attr.Class, "col-md-12 col-lg-offset-0" },
                { Attr.Style, "margin-left: 20px;" },
            };
            var div        = TagHelper.Create(Tag.div, attributes1, ul);
            var pageHeader = TagHelper.Create(Tag.div, b);
            var container  = TagHelper.Div("container", div);
            var mainRaised = TagHelper.Div("main main-raised", container);

            var body = TagHelper.Create(Tag.body, new TagAttribute(Attr.Class, "profile-page"), Navigation.GetNavbar());

            body.Content.AppendHtml(pageHeader);
            body.Content.AppendHtml(mainRaised);
            body.Content.AppendHtml(this.Footer());

            return(body);
        }
예제 #5
0
        public IHtmlContent Render(TModel entity)
        {
            string id    = new Identifier().Value;
            object value = default;
            string name  = this.expression.GetPropertyName();

            if (entity != null)
            {
                value = this.modelExpression.Compile()(entity);
            }

            TagAttributeList attributes = new TagAttributeList
            {
                { Attr.Href, "#pablo" },
                { Attr.Class, "btn btn-primary btn-round" },
                { Attr.Type, "submit" },
                { Attr.Name, name },
                { Attr.Value, value },
                { Attr.Url, this.url },
            };

            var a = TagHelper.Create(Tag.a, attributes, this.lableText);

            return(TagHelper.Div("modal-footer text-center", a));
        }
예제 #6
0
        public IHtmlContent Render(TModel entity)
        {
            string id    = new Identifier().Value;
            string value = default;
            string name  = this.expression.GetPropertyName();

            if (entity != null)
            {
                value = this.modelExpression.Compile()(entity);
            }

            TagAttributeList attributes = new TagAttributeList
            {
                { Attr.Type, "text" },
                { Attr.Class, "form-control" },
                { Attr.Value, value },
                { Attr.Name, name },
                { Attr.AutoComplete, "off" },
            };

            var label = TagHelper.Create(Tag.label, new TagAttribute(Attr.Class, "control-label"), this.lable);
            var input = TagHelper.Create(Tag.input, attributes);
            var span  = TagHelper.Create(Tag.span, new TagAttribute(Attr.Class, "form-control-feedback"), new MaterialIcon("done").Html);

            return(TagHelper.Div("form-group label-floating has-success", label, input, span));
        }
예제 #7
0
        private IHtmlContent Large(TModel mode)
        {
            var div1 = TagHelper.Div("card-content", this.textBox.Render(mode));
            var div2 = TagHelper.Div(this.IsFilter ? this.GetClass(2, 0) : this.GetClass(10, 1), div1);

            return(div2);
        }
예제 #8
0
        private IHtmlContent Small(TModel mode)
        {
            var div3 = TagHelper.Div("col-md-5 col-md-offset-1", this.left.Render(mode));
            var div6 = TagHelper.Div("col-md-5", this.right.Render(mode));

            return(TagHelper.Content(div3, div6));
        }
예제 #9
0
        public IHtmlContent Render(TModel entity)
        {
            string id    = new Identifier().Value;
            bool?  value = default;
            string name  = this.expression.GetPropertyName();

            if (entity != null)
            {
                value = this.modelExpression.Compile()(entity);
            }

            TagAttributeList attributes = new TagAttributeList
            {
                { Attr.Type, "checkbox" },
                { Attr.Name, name },
            };

            if (value.HasValue && value.Value)
            {
                attributes.Add(new TagAttribute(Attr.Checked));
            }

            var input = TagHelper.Create(Tag.input, attributes);
            var label = TagHelper.Create(Tag.label, input);

            label.PostElement.AppendHtml(this.text);

            return(TagHelper.Div("checkbox", label));
        }
예제 #10
0
        protected override IHtmlContent Body()
        {
            var b = new TagAttributeList()
            {
                { Attr.Class, "page-header header-filter" },
                { Attr.DataParallax, "true" },
                { Attr.Style, "background-image: url('/img/examples/city.jpg');" },
            };
            var attributes = new TagAttributeList()
            {
                { Attr.Role, "button" },
                { Attr.DataToggle, "collapse" },
                { Attr.DataParent, "#accordion" },
                { Attr.Href, "#collapseOne" },
                { Attr.AriaExpanded, "false" },
                { Attr.AriaControls, "collapseOne" },
                { Attr.Class, "collapsed" },
            };
            var attributes2 = new TagAttributeList()
            {
                { Attr.Id, "collapseOne" },
                { Attr.Class, "panel-collapse collapse" },
                { Attr.Role, "tabpanel" },
                { Attr.AriaLabelledBy, "headingOne" },
                { Attr.AriaExpanded, "false" },
                { Attr.Style, "height: 0px;" },
            };
            var attributes1 = new TagAttributeList()
            {
                { Attr.Class, "panel-heading" },
                { Attr.Role, "tab" }, { Attr.Id, "headingOne" },
            };

            var colmd     = TagHelper.Div("col-md-12 col-lg-offset-0 text-right", this.GenerateButtons());
            var panelbody = TagHelper.Div("panel-body", colmd, TagHelper.Create(Tag.form, this.RenderFilter()));
            var tabpanel  = TagHelper.Create(Tag.div, attributes2, panelbody);
            var h4        = TagHelper.Create(Tag.h4, new TagAttribute(Attr.Class, "panel-title"), "Filter");

            h4.Content.AppendHtml(new MaterialIcon("keyboard_arrow_down").Html);
            var button         = TagHelper.Create(Tag.a, attributes, h4);
            var heading        = TagHelper.Create(Tag.div, attributes1, button);
            var panel          = TagHelper.Div("panel panel-default", heading, tabpanel);
            var grid           = TagHelper.Div("col-md-12 col-lg-offset-0 text-left", this.GenerateButtons(), this.GridConfiguration.Render(this.index, this.size, this.list, this.total));
            var div2           = TagHelper.Div("col-md-12 col-lg-offset-0", grid);
            var div1           = TagHelper.Div("col-md-12 col-lg-offset-0", panel);
            var row            = TagHelper.Div("row", div1, div2);
            var container      = TagHelper.Div("container", row);
            var profileContent = TagHelper.Div("profile-content", container);
            var mainRaised     = TagHelper.Div("main main-raised", profileContent);
            var pageHeader     = TagHelper.Create(Tag.div, b);
            var body           = TagHelper.Create(Tag.body, new TagAttribute(Attr.Class, "profile-page"), Navigation.GetNavbar());

            body.Content.AppendHtml(pageHeader);
            body.Content.AppendHtml(mainRaised);
            body.Content.AppendHtml(this.Footer());
            return(body);
        }
예제 #11
0
        private IHtmlContent Middle(TModel mode)
        {
            var div1  = TagHelper.Div("card-content", this.left.Render(mode));
            int width = (int)this.left.Width;
            var div2  = TagHelper.Div(this.GetClass(width, 1), div1);

            var div3 = TagHelper.Div("card-content", this.right.Render(mode));
            var div4 = TagHelper.Div(this.GetClass((int)this.right.Width, 5 - width), div3);

            return(TagHelper.Content(div2, div4));
        }
예제 #12
0
        private IHtmlContent Small(TModel mode)
        {
            // 5 , 2, 3
            var div1 = TagHelper.Div("card-content", this.left.Render(mode));
            var div2 = TagHelper.Div(this.GetClass(5, 1), div1);

            var div3 = TagHelper.Div("card-content", this.middle.Render(mode));
            var div4 = TagHelper.Div(this.GetClass(2, 0), div3);

            var div5 = TagHelper.Div("card-content", this.right.Render(mode));
            var div6 = TagHelper.Div(this.GetClass(3, 0), div5);

            return(TagHelper.Content(div2, div4, div6));
        }
예제 #13
0
        public string ToHtml()
        {
            TagAttributeList attributes = new TagAttributeList()
            {
                new TagAttribute(Attr.Type, "button"),
                new TagAttribute(Attr.Class, "close"),
                new TagAttribute(Attr.DataDismiss, "modal"),
                new TagAttribute(Attr.AriaHidden, "true"),
            };
            var button = TagHelper.Create(Tag.button, attributes, new MaterialIcon("clear").Html);
            var header = TagHelper.Div("modal-header", button);

            var h5   = TagHelper.Create(Tag.h5, this.text);
            var body = TagHelper.Div("modal-body text-center", h5);

            var attributes1 = new TagAttributeList()
            {
                new TagAttribute(Attr.Type, "button"),
                new TagAttribute(Attr.Class, "btn btn-simple"),
                new TagAttribute(Attr.DataDismiss, "modal"),
            };
            var attributes2 = new TagAttributeList()
            {
                new TagAttribute(Attr.Type, "button"),
                new TagAttribute(Attr.Class, "btn btn-success btn-simple"),
                new TagAttribute(Attr.Id, this.id.ToString()),
                new TagAttribute(Attr.Action, ScheduleRoute.Delete),
            };
            var button1 = TagHelper.Create(Tag.button, attributes1, "取消");
            var button2 = TagHelper.Create(Tag.button, attributes2, "确定");
            var footer  = TagHelper.Div("modal-footer text-center", button1, button2);

            var content = TagHelper.Div("modal-content", header, body, footer);
            var dialog  = TagHelper.Div("modal-dialog modal-small", content);

            TagAttributeList attributes3 = new TagAttributeList()
            {
                new TagAttribute(Attr.Class, "modal fade"),
                new TagAttribute(Attr.Id, "smallAlertModal"),
                new TagAttribute(Attr.TabIndex, "-1"),
                new TagAttribute(Attr.Role, "dialog"),
                new TagAttribute(Attr.AriaLabelledBy, "myModalLabel"),
                new TagAttribute(Attr.AriaHidden, "true"),
            };

            var dialog1 = TagHelper.Create(Tag.div, attributes3, dialog);

            return(TagHelper.ToHtml(dialog1));
        }
예제 #14
0
        public string ToHtml()
        {
            TagAttributeList attributes = new TagAttributeList()
            {
                new TagAttribute(Attr.Type, "text"),
                new TagAttribute(Attr.Class, "form-control"),
                new TagAttribute(Attr.Placeholder, "With Font Awesome Icons"),
            };

            var input = TagHelper.Create(Tag.input, attributes);
            var span  = TagHelper.Create(Tag.span, new TagAttribute(Attr.Class, "input-group-addon"), new FontAwesomeIcon().Html);

            input.TagMode = Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing;
            var div = TagHelper.Div("input-group", span, input);

            return(TagHelper.ToHtml(div));
        }
예제 #15
0
        public IHtmlContent Render(int index, int size, IList <TModel> list, int total)
        {
            Check.NotEmpty(list.ToList(), nameof(list));

            IList <BaseGridColumn <TModel> > gridColumns = new List <BaseGridColumn <TModel> >();

            this.CreateGridColumn(gridColumns);

            var thead = TagHelper.Create(Tag.th, new TagAttribute(Attr.Class, "text-center"), "#");

            foreach (var item in gridColumns)
            {
                thead.Content.AppendHtml(item.RenderTh());
            }

            var tbody = TagHelper.Create(Tag.tbody);

            foreach (var entity in list)
            {
                int row = ((index - 1) * size) + list.IndexOf(entity) + 1;
                var tr  = TagHelper.Create(Tag.td, new TagAttribute(Attr.Class, "text-center"), row.ToString());
                foreach (var item in gridColumns)
                {
                    tr.Content.AppendHtml(item.RenderTd(entity));
                }

                tbody.Content.AppendHtml(TagHelper.Create(Tag.tr, tr));
            }

            var theadTag        = TagHelper.Create(Tag.thead, TagHelper.Create(Tag.tr, thead));
            var table           = TagHelper.Create(Tag.table, new TagAttribute(Attr.Class, "table table-striped"), theadTag, tbody);
            var responsiveTable = TagHelper.Div("table-responsive", table);

            responsiveTable.Attributes.Add(Attr.Url, this.GridStateChange);
            responsiveTable.Attributes.Add(Attr.Data, JsonConvert.SerializeObject(this.Data));
            if (this.EnablePagination)
            {
                responsiveTable.PostElement.AppendHtml(new Pagination().Render(index, size, total));
            }

            return(responsiveTable);
        }
예제 #16
0
 private IHtmlContent Large(TModel mode)
 {
     return(TagHelper.Div("col-md-10 col-md-offset-1", this.textBox.Render(mode)));
 }