コード例 #1
0
 public static MvcHtmlString UxPopoverAttributes(this HtmlHelper helper,
     string title,
     string content, 
     bool isHtml = false,
     PopoverPlacement placement = PopoverPlacement.Auto,
     PopoverTrigger trigger = PopoverTrigger.Click,
     string container = null)
 {
     var popover = new Popover(title, content, isHtml, placement, trigger, container);
     return popover.ToHtmlString();
 }
コード例 #2
0
ファイル: Popover.cs プロジェクト: renhammington/UxFoundation
 public Popover(string title, 
     string content, 
     bool isHtml = false, 
     PopoverPlacement placement = PopoverPlacement.Auto, 
     PopoverTrigger trigger = PopoverTrigger.Click, 
     string container = null)
 {
     IsHtml = isHtml;
     Title = title;
     Content = content;
     Container = container;
     Placement = placement;
     Trigger = trigger;
 }
コード例 #3
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (Popover)
            {
                output.Attributes.RemoveAll("popover");

                output.Attributes.Add("data-toggle", "kt-popover");

                output.Attributes.Add("data-container", "body");

                if (PopoverPlacement.IsUsed())
                {
                    output.Attributes.RemoveAll("popover-placement");

                    output.Attributes.Add("data-placement", PopoverPlacement.ToValue());
                }

                if (PopoverTrigger.IsUsed())
                {
                    output.Attributes.RemoveAll("popover-trigger");

                    output.Attributes.Add("data-trigger", PopoverTrigger.ToValue());
                }

                if (!String.IsNullOrWhiteSpace(PopoverTitle))
                {
                    output.Attributes.RemoveAll("popover-title");

                    output.Attributes.Add("data-original-title", PopoverTitle);
                }

                if (!String.IsNullOrWhiteSpace(PopoverContent))
                {
                    output.Attributes.RemoveAll("popover-content");

                    output.Attributes.Add("data-content", PopoverContent);

                    output.Attributes.Add("data-html", "true");
                }

                if (PopoverOffset != default)
                {
                    output.Attributes.RemoveAll("popover-offset");

                    output.Attributes.Add("data-offset", $"{PopoverOffset.Item1}px {PopoverOffset.Item2}px");
                }
            }
        }