예제 #1
0
        /// <summary>
        /// Creates the framework control.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        /// <returns>The control instance.</returns>
        protected override IFWHtmlElement RenderControl(TagHelperContext context, TagHelperOutput output)
        {
            var control = new FWButtonControl(Id);

            if ((!ChildContent.IsEmptyOrWhiteSpace))
            {
                control.Text = ChildContent.GetContent();
            }

            control.ButtonType(ResolveButtonType());
            control.Size(Size);

            if (Url != null)
            {
                control.Url(Url);
            }

            if (Behavior.HasValue)
            {
                control.Behavior(Behavior.Value);
            }

            if (ConfirmTitle != null && ConfirmMessage != null)
            {
                control.Confirm(ConfirmTitle, ConfirmMessage);
            }

            if (Color.HasValue)
            {
                control.Color(Color.Value);
            }

            if (Icon != null)
            {
                control.Icon(Icon);
            }

            control.Attributes.Add("data-control", "button");

            if (context.Items.ContainsKey("btngroup"))
            {
                var group = context.Items["btngroup"] as FWButtonGroupControl;
                group.AddButton(control);
            }

            return(control);
        }
예제 #2
0
        private void AddInputLayout(FWDivElement body)
        {
            body.AddCssClass("upload");
            body.Attributes.Add("data-theme", "input");

            body.Add($"<div data-type=\"upload-template\" data-toggle=\"popover\" class=\"dz-preview\"><img data-dz-thumbnail style=\"display:none\" /><span data-dz-name></span><span data-dz-progress></span><span data-type=\"Remove\" class=\"m--font-danger\" title=\"{ViewResources.Btn_Upload_Remove}\"><i class=\"fas fa-ban\"></i></span></div>");

            body.Add("<div data-type=\"upload-preview\" class=\"upload-preview\"></div>");

            var button = new FWButtonControl($"{Id}_btn_upload")
            {
                Text     = _maxFiles == 1 ? ViewResources.Btn_Upload : ViewResources.Btn_Upload_Multiple,
                DataType = "upload-clickable"
            };

            button.Icon("fas fa-upload");
            button.Size(FWElementSize.Small);
            body.Add(button.ToString());
        }