/// <summary> /// Renders the panel header and returns the HTML /// </summary> /// <returns></returns> internal string GetTagHtml() { Accordion ac = this.OnPanel.OnAccordion; bool prettyRender = ac.Rendering.PrettyRender; bool renderCss = ac.Rendering.RenderCSS; int tabDepth = ac.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth + 1); // H3 tag (or whatever if it's been overridden in the options) sb.AppendLineIf(); sb.AppendTabsFormatIf("<{0}", ac.Options.HeadingTag); if (renderCss) { base.WithCss("ui-accordion-header ui-helper-reset ui-state-default"); if (this.OnPanel.IsActive) base.WithCss("ui-state-active ui-corner-top"); else base.WithCss("ui-corner-all"); } // add in any attributes the user has added base.RenderAttributes(sb); // and close off the starting H3 tag sb.Append(">"); sb.Append(this.OnPanel.Title); // Closing heading (H3) sb.AppendFormatLineIf("</{0}>", ac.Options.HeadingTag); return sb.ToString(); }
/// <summary> /// Renders the HTML for the hyperlink. /// </summary> /// <returns>String of HTML</returns> public string GetTagHtml() { Accordion ac = this._Header.OnPanel.OnAccordion; bool prettyRender = ac.Rendering.PrettyRender; bool renderCss = ac.Rendering.RenderCSS; int tabDepth = ac.Rendering.TabDepth; jStringBuilder sb = new jStringBuilder(prettyRender, tabDepth); sb.AppendTabsFormatIf("<a href=\"{0}\">", this.URL); base.RenderAttributes(sb); sb.Append(this.Title); sb.Append("</a>"); return sb.ToString(); }
} // Render /// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$(\"#{0}\").autocomplete(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
/// <summary> /// Renders the body of the accordion panel. /// </summary> /// <param name="sb">StringBuilder to render the object to</param> internal void RenderBody(jStringBuilder sb) { bool renderCss = this.OnAccordion.Rendering.RenderCSS; // Opening pane container div sb.AppendTabsFormatIf("<{0}", this.OnAccordion.Options.ContentTag); base.RenderAttributes(sb); if (renderCss) { sb.Append(" class=\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); // may seem strange, but when renderCss is on, we always need the "ui-accordion-content-active" // presented otherwise the panel will be collapsed (hidden) and if JavaScript isn't on, the user // will have no way of seeing the content ! sb.Append(" ui-accordion-content-active"); sb.Append("\""); } sb.Append(">"); sb.AppendLineIf(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); string selector = ""; if (IsGlobal()) selector = Options.DEFAULT_TARGET; else selector = string.Format("\"#{0}\"", this.ID); sb.IncIndent(); sb.AppendTabsFormatIf("$({0}).tooltip(", selector); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
/// <summary> /// Renders the body of the accordion panel. /// </summary> /// <param name="sb">StringBuilder to render the object to</param> internal void RenderBody(jStringBuilder sb) { bool renderCss = this.OnAccordion.Rendering.RenderCSS; // Opening pane container div sb.AppendTabsFormatIf("<{0}", this.OnAccordion.Options.ContentTag); base.RenderAttributes(sb); if (renderCss) { sb.Append(" class=\"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); if (this.IsActive) sb.Append(" ui-accordion-content-active"); sb.Append("\""); } sb.Append(">"); sb.AppendLineIf(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code (see <see cref="Core.Rendering.PrettyRender"/> setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> public string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$.ajax(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); options.Render(sb); sb.Append(");"); sb.DecIndent(); return sb.ToString(); }
/// <summary> /// Writes out the calling script for the jQuery Tabs plugin, adding options that have been /// a defined. /// </summary> /// <param name="tabDepth"> /// How far to indent the script code setting. /// </param> /// <returns> /// Returns rendered initialisation script /// </returns> protected internal string GetControlScript(int tabDepth) { jStringBuilder sb = new jStringBuilder(this.Rendering.PrettyRender, this.Rendering.TabDepth); sb.IncIndent(); sb.AppendTabsFormatIf("$(\"#{0}\").button(", this.ID); Core.ScriptOptions options = new Core.ScriptOptions(); this.Options.DiscoverOptions(options); this.Events.DiscoverOptions(options); options.Render(sb); sb.Append(");"); if (!string.IsNullOrEmpty(this.Events.ClickEvent)) { // as ClickEvent isn't a "real" jQuery UI button event, it has to be wired up separately sb.AppendLineIf(); sb.AppendTabsFormatLineIf("$(\"#{0}\").click(function() {{", this.ID); sb.Append(this.Events.ClickEvent); sb.AppendLineIf(); sb.AppendTabsLineIf("});"); } sb.DecIndent(); return sb.ToString(); }