Exemplo n.º 1
0
        protected override void OnStart(TextWriter writer)
        {
            // Make sure we're in a PanelHeading
            if (GetComponent <PanelHeading>() == null)
            {
                GetHelper().PanelHeading().Component.Start(writer);
            }

            Panel panel = GetComponent <Panel>();

            if (panel != null && panel.Collapsible)
            {
                ComponentBuilder <BootstrapConfig, Link> link = GetHelper()
                                                                .Link(TextContent, $"#{panel.Id}_collapse")
                                                                .AddAttribute("data-toggle", "collapse");

                PanelGroup panelGroup = GetComponent <PanelGroup>();
                if (panelGroup != null && panelGroup.Accordion)
                {
                    link.AddAttribute("data-parent", $"#{panelGroup.Id}");
                }

                AddChild(link);
                TextContent = null;
            }

            base.OnStart(writer);
        }
Exemplo n.º 2
0
        protected override void OnStart(TextWriter writer)
        {
            PanelGroup panelGroup = GetComponent <PanelGroup>();

            if (panelGroup != null)
            {
                if (panelGroup.Accordion)
                {
                    Collapsible = true;
                    if (string.IsNullOrWhiteSpace(Id))
                    {
                        Id = $"{panelGroup.Id}_panel{panelGroup.PanelCounter}";
                    }
                }
                panelGroup.PanelCounter++;
            }
            else if (Collapsible)
            {
                if (string.IsNullOrWhiteSpace(Id))
                {
                    Id = $"panel{DateTime.Now.Ticks}";
                }
            }
            base.OnStart(writer);
        }