/// <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) { if (Id == null) { Id = TagBuilder.CreateSanitizedId(Path.GetFileNameWithoutExtension(ViewContext.View.Path), "_"); } FWGridOptions options = CreateComponentConfig(); // Gets the metadata from the return type of the service method. var metadata = RequestContext.MetadataProvider.GetMetadataForType(options.ServiceMethod.ReturnParameter.ParameterType); var control = new FWGridControl(RequestContext, metadata, options) { AutoSizeColumns = AutoSizeColumns }; control.Attributes.Add("data-control", "grid"); if (AutoGenerateColumns.HasValue) { options.FluentConfiguration.Add(x => x.AutoGenerateColumns(AutoGenerateColumns.Value)); control.AutoGenerateColumns(AutoGenerateColumns.Value); } context.Items["TemplateOptions"] = options; ChildContent.GetContent(); return(control); }
/// <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 modal = context.Items["modal"] as FWModalControl; modal.Body = ChildContent.GetContent(); return(modal); }
/// <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 message = ChildContent.GetContent(); var control = new FWMessageControl(message, Type); control.AllowClose(AllowClose); return(control); }
/// <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 FWAccordionControl(Id); control.Attributes.Add("data-control", "accordion"); context.Items["accordion"] = control; control.ChildBody = ChildContent.GetContent(); return(control); }
/// <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 element = new FWDivElement { DataType = "upload-template" }; element.Add(ChildContent.GetContent()); return(element); }
/// <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 FWInputControl RenderInputControl(TagHelperContext context, TagHelperOutput output) { var control = new FWUploadControl(RequestContext, For.Model, For.Metadata, Layout); control.Attributes.Add("data-control", "upload"); if (Layout == FWUploadLayout.Custom) { control.LayoutBody = ChildContent.GetContent(); } return(control); }
/// <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 tab = context.Items["tab"] as FWTabControl; if (LazyUrl == null) { tab.AddContentTab(Header, ChildContent.GetContent()); } else { tab.AddLazyTab(Header, LazyUrl, Cached); } return(tab); }
/// <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 tab = context.Items["accordion"] as FWAccordionControl; if (LazyUrl == null) { tab.AddContentItem(Header, ChildContent.GetContent(), Icon); } else { tab.AddLazyItem(Header, LazyUrl, Cached, Icon); } return(tab); }
/// <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); }
/// <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 FWPortletControl(Id, Header) { AllowFullscreen = AllowFullscreen }; control.Attributes.Add("data-control", "panel"); control.ChildBody = ChildContent.GetContent(); if (Icon != null) { control.Icon(Icon); } return(control); }
/// <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 FWModalControl(Id, Title, Size) { // Sets the url to load the content from. ContentUrl = ContentUrl, // Sets the modal form action. FormUrl = FormUrl }; control.Attributes.Add("data-control", "modal"); context.Items["modal"] = control; // If no url is defined, load the body from the tag helper child content. ChildContent.GetContent(); context.Items.Remove("modal"); return(control); }
/// <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 options = context.Items["TemplateOptions"] as FWListOptions; if (options == null) { return(null); } context.StartInnerContent(); var content = ChildContent.GetContent(); context.EndInnerContent(); if (content != null) { // TODO: Url.Action will encode { and } characters. Is there anyway to improve the performance by removing the replaces below? content = content.Replace("%7B", "{").Replace("%7D", "}"); options.FluentConfiguration.Add(x => x.Template(content).ColumnClass(CssClass)); } return(null); }
/// <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 FWButtonGroupControl(Id, VisibleButtons) { Title = Title }; if (Color.HasValue) { control.Color(Color.Value); } if (Size.HasValue) { control.Size(Size.Value); } context.Items["btngroup"] = control; ChildContent.GetContent(); // Clears the group button. context.Items.Remove("btngroup"); return(control); }