├── .gitignore ├── .vs └── config │ └── .gitignore ├── FluentBootstrap.Mvc.T4MVC ├── FluentBootstrap.Mvc.T4MVC.csproj ├── FluentBootstrap.Mvc.T4MVC.nuspec ├── Properties │ └── AssemblyInfo.cs ├── T4MVCExtensions.cs └── packages.config ├── FluentBootstrap.Mvc ├── FluentBootstrap.Mvc.csproj ├── FluentBootstrap.Mvc.nuspec ├── Forms │ ├── CheckBoxFor.cs │ ├── FormControlFor.cs │ ├── FormControlForBase.cs │ ├── FormControlListFor.cs │ ├── FormControlOverride.cs │ ├── FormOverride.cs │ ├── HiddenFor.cs │ ├── MvcFormExtensions.cs │ └── ValidationSummary.cs ├── HtmlHelperExtensions.cs ├── InternalsExtensions.cs ├── MvcBootstrapConfig.cs ├── MvcBootstrapHelper.cs ├── MvcExtensions.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── FluentBootstrap.Tests.Web ├── App_Start │ ├── RazorGeneratorMvcStart.cs │ └── RouteConfig.cs ├── Content │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ └── bootstrap.min.css ├── Controllers │ ├── HomeController.cs │ ├── MvcTestsController.cs │ └── TestsController.cs ├── FluentBootstrap.Tests.Web.csproj ├── Global.asax ├── Global.asax.cs ├── Models │ └── MvcTests │ │ └── ViewModel.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-2.1.3.intellisense.js │ ├── jquery-2.1.3.js │ ├── jquery-2.1.3.min.js │ └── jquery-2.1.3.min.map ├── Views │ ├── Home │ │ └── Index.cshtml │ ├── MvcTests │ │ └── MvcForms.cshtml │ ├── Shared │ │ └── _Layout.cshtml │ ├── Tests │ │ ├── Alerts.cshtml │ │ ├── Architecture.cshtml │ │ ├── Badges.cshtml │ │ ├── Breadcrumbs.cshtml │ │ ├── Buttons.cshtml │ │ ├── Dropdowns.cshtml │ │ ├── Forms.cshtml │ │ ├── Grids.cshtml │ │ ├── Icons.cshtml │ │ ├── Images.cshtml │ │ ├── Labels.cshtml │ │ ├── Links.cshtml │ │ ├── ListGroups.cshtml │ │ ├── MediaObjects.cshtml │ │ ├── Misc.cshtml │ │ ├── Navbars.cshtml │ │ ├── Navs.cshtml │ │ ├── Pagers.cshtml │ │ ├── Paginations.cshtml │ │ ├── ProgressBars.cshtml │ │ ├── Tables.cshtml │ │ ├── Tags.cshtml │ │ ├── Thumbnails.cshtml │ │ └── Typography.cshtml │ ├── _ViewStart.cshtml │ └── web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── packages.config ├── FluentBootstrap.Tests ├── AlertsFixture.cs ├── App.config ├── ArchitectureFixture.cs ├── BadgesFixture.cs ├── BreadcrumbsFixture.cs ├── ButtonsFixture.cs ├── DropdownsFixture.cs ├── FluentBootstrap.Tests.csproj ├── FormsFixture.cs ├── GridsFixture.cs ├── IconsFixture.cs ├── ImagesFixture.cs ├── LabelsFixture.cs ├── LinksFixture.cs ├── ListGroupsFixture.cs ├── MediaObjectsFixture.cs ├── MiscFixture.cs ├── MvcFormsFixture.cs ├── NavbarsFixture.cs ├── NavsFixture.cs ├── PagersFixture.cs ├── PaginationsFixture.cs ├── ProgressBarsFixture.cs ├── Properties │ └── AssemblyInfo.cs ├── SimpleBootstrapHelperFixture.cs ├── TablesFixture.cs ├── TagsFixture.cs ├── TestHelper.cs ├── ThumbnailsFixture.cs ├── TypographyFixture.cs └── packages.config ├── FluentBootstrap.WebPages ├── FluentBootstrap.WebPages.csproj ├── FluentBootstrap.WebPages.nuspec ├── HtmlHelperExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── WebPagesBootstrapConfig.cs └── WebPagesBootstrapHelper.cs ├── FluentBootstrap.jmconfig ├── FluentBootstrap.sln ├── FluentBootstrap ├── Alerts │ ├── Alert.cs │ ├── AlertExtensions.cs │ └── AlertState.cs ├── BackgroundState.cs ├── Badges │ ├── Badge.cs │ └── BadgeExtensions.cs ├── BootstrapConfig.cs ├── BootstrapHelper.cs ├── Breadcrumbs │ ├── Breadcrumb.cs │ ├── BreadcrumbExtensions.cs │ └── Crumb.cs ├── Buttons │ ├── Button.cs │ ├── ButtonDropdown.cs │ ├── ButtonExtensions.cs │ ├── ButtonGroup.cs │ ├── ButtonGroupSize.cs │ ├── ButtonSize.cs │ ├── ButtonState.cs │ ├── ButtonToolbar.cs │ ├── ButtonType.cs │ ├── IHasButtonExtensions.cs │ ├── IHasButtonStateExtensions.cs │ └── LinkButton.cs ├── Component.cs ├── ComponentBuilder.cs ├── ComponentExtensions.cs ├── ComponentOverride.cs ├── ComponentWrapper.cs ├── Content.cs ├── Content │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ └── bootstrap.min.css ├── ContentExtensions.cs ├── Css.cs ├── Css.tt ├── Dropdowns │ ├── Dropdown.cs │ ├── DropdownDivider.cs │ ├── DropdownExtensions.cs │ ├── DropdownHeader.cs │ └── DropdownLink.cs ├── EnumExtensions.cs ├── FluentBootstrap.csproj ├── FluentBootstrap.nuspec ├── Forms │ ├── CheckedControl.cs │ ├── ControlLabel.cs │ ├── FieldSet.cs │ ├── Form.cs │ ├── FormButton.cs │ ├── FormControl.cs │ ├── FormExtensions.cs │ ├── FormGroup.cs │ ├── FormInputType.cs │ ├── HelpBlock.cs │ ├── Hidden.cs │ ├── IFormValidation.cs │ ├── Input.cs │ ├── InputButton.cs │ ├── InputGroup.cs │ ├── InputGroupAddon.cs │ ├── InputGroupButton.cs │ ├── InputGroupSize.cs │ ├── InputSize.cs │ ├── Select.cs │ ├── SelectOption.cs │ ├── Static.cs │ ├── TextArea.cs │ └── ValidationState.cs ├── Grids │ ├── Container.cs │ ├── GridColumn.cs │ ├── GridColumnExtensions.cs │ ├── GridExtensions.cs │ ├── GridRow.cs │ └── IHasGridColumnExtensions.cs ├── Html │ ├── Element.cs │ ├── HtmlExtensions.cs │ └── Paragraph.cs ├── ICanCreate.cs ├── IHasDisabledAttribute.cs ├── IHasNameAttribute.cs ├── IHasTextContent.cs ├── IHasTitleAttribute.cs ├── IHasValueAttribute.cs ├── Icons │ ├── IHasIcon.cs │ ├── Icon.cs │ ├── Icon.tt │ ├── IconExtensions.cs │ └── IconSpan.cs ├── Images │ ├── Image.cs │ ├── ImageBase.cs │ ├── ImageExtensions.cs │ ├── ImageStyle.cs │ └── Placeholder.cs ├── InternalsExtensions.cs ├── KeyValueList.cs ├── Labels │ ├── Label.cs │ ├── LabelExtensions.cs │ └── LabelState.cs ├── Links │ ├── IHasLinkExtensions.cs │ ├── Link.cs │ └── LinkExtensions.cs ├── ListGroups │ ├── ListGroup.cs │ ├── ListGroupButton.cs │ ├── ListGroupExtensions.cs │ ├── ListGroupItem.cs │ └── ListGroupItemState.cs ├── MediaObjects │ ├── Media.cs │ ├── MediaBody.cs │ ├── MediaList.cs │ ├── MediaObject.cs │ └── MediaObjectExtensions.cs ├── MergeableDictionary.cs ├── Misc │ ├── Jumbotron.cs │ ├── MiscExtensions.cs │ └── PageHeader.cs ├── Navbars │ ├── Brand.cs │ ├── INavbarComponent.cs │ ├── Navbar.cs │ ├── NavbarButton.cs │ ├── NavbarCollapse.cs │ ├── NavbarExtensions.cs │ ├── NavbarForm.cs │ ├── NavbarHeader.cs │ ├── NavbarLink.cs │ ├── NavbarNav.cs │ ├── NavbarPosition.cs │ ├── NavbarSection.cs │ ├── NavbarText.cs │ └── NavbarToggle.cs ├── Navs │ ├── Nav.cs │ ├── NavExtensions.cs │ ├── NavLink.cs │ ├── Pill.cs │ ├── Pills.cs │ ├── Tab.cs │ └── Tabs.cs ├── Pagers │ ├── Page.cs │ ├── PageAlignment.cs │ ├── Pager.cs │ └── PagerExtensions.cs ├── Paginations │ ├── PageNum.cs │ ├── Pagination.cs │ ├── PaginationExtensions.cs │ └── PaginationSize.cs ├── Panels │ ├── Panel.cs │ ├── PanelBody.cs │ ├── PanelExtensions.cs │ ├── PanelFooter.cs │ ├── PanelHeading.cs │ ├── PanelSection.cs │ ├── PanelState.cs │ ├── PanelTable.cs │ └── PanelTitle.cs ├── ProgressBars │ ├── Progress.cs │ ├── ProgressBar.cs │ ├── ProgressBarExtensions.cs │ └── ProgressBarState.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-2.1.3.intellisense.js │ ├── jquery-2.1.3.js │ ├── jquery-2.1.3.min.js │ └── jquery-2.1.3.min.map ├── SimpleBootstrapConfig.cs ├── SimpleBootstrapHelper.cs ├── SuppressOutputWriter.cs ├── Tables │ ├── IHasTableStateExtensions.cs │ ├── Table.cs │ ├── TableBodySection.cs │ ├── TableCell.cs │ ├── TableData.cs │ ├── TableExtensions.cs │ ├── TableFootSection.cs │ ├── TableHeadSection.cs │ ├── TableHeader.cs │ ├── TableRow.cs │ ├── TableSection.cs │ ├── TableState.cs │ └── TableStyle.cs ├── Tag.cs ├── TagExtensions.cs ├── TextState.cs ├── Thumbnails │ ├── Caption.cs │ ├── Thumbnail.cs │ ├── ThumbnailContainer.cs │ └── ThumbnailExtensions.cs ├── Typography │ ├── Abbr.cs │ ├── Blockquote.cs │ ├── Cite.cs │ ├── Description.cs │ ├── DescriptionList.cs │ ├── DescriptionTerm.cs │ ├── Heading.cs │ ├── List.cs │ ├── ListItem.cs │ ├── ListType.cs │ ├── Pre.cs │ ├── Small.cs │ ├── TextAlignment.cs │ ├── TextTransformation.cs │ └── TypographyExtensions.cs ├── Visibility.cs ├── Wells │ ├── Well.cs │ ├── WellExtensions.cs │ └── WellSize.cs ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── packages.config ├── appveyor.yml ├── license.txt ├── packages ├── Microsoft.CodeAnalysis.Analyzers.1.0.0 │ ├── Microsoft.CodeAnalysis.Analyzers.1.0.0.nupkg │ ├── ThirdPartyNotices.rtf │ ├── analyzers │ │ └── dotnet │ │ │ ├── cs │ │ │ ├── Microsoft.CodeAnalysis.Analyzers.dll │ │ │ └── Microsoft.CodeAnalysis.CSharp.Analyzers.dll │ │ │ └── vb │ │ │ ├── Microsoft.CodeAnalysis.Analyzers.dll │ │ │ └── Microsoft.CodeAnalysis.VisualBasic.Analyzers.dll │ └── tools │ │ ├── install.ps1 │ │ └── uninstall.ps1 ├── Microsoft.CodeAnalysis.CSharp.1.0.0 │ ├── Microsoft.CodeAnalysis.CSharp.1.0.0.nupkg │ ├── ThirdPartyNotices.rtf │ └── lib │ │ ├── net45 │ │ ├── Microsoft.CodeAnalysis.CSharp.dll │ │ └── Microsoft.CodeAnalysis.CSharp.xml │ │ └── portable-net45+win8 │ │ ├── Microsoft.CodeAnalysis.CSharp.dll │ │ └── Microsoft.CodeAnalysis.CSharp.xml └── Microsoft.CodeAnalysis.Common.1.0.0 │ ├── Microsoft.CodeAnalysis.Common.1.0.0.nupkg │ ├── ThirdPartyNotices.rtf │ └── lib │ ├── net45 │ ├── Microsoft.CodeAnalysis.dll │ └── Microsoft.CodeAnalysis.xml │ └── portable-net45+win8 │ ├── Microsoft.CodeAnalysis.dll │ └── Microsoft.CodeAnalysis.xml └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.com 2 | *.class 3 | *.exe 4 | !NuGet.exe 5 | *.o 6 | *.so 7 | *.user 8 | Thumbs.db 9 | _ReSharper* 10 | *ReSharper.user 11 | *dotCover 12 | .JustCode 13 | *.suo 14 | bin 15 | obj 16 | .svn 17 | ipch 18 | *.ilk 19 | *.sdf 20 | *.opensdf 21 | *.pdb 22 | /*.~vsd 23 | *UpgradeWizard* 24 | packages/* 25 | !packages/Microsoft.CodeAnalysis.* 26 | *ncrunch* 27 | *crunch*.local.xml -------------------------------------------------------------------------------- /.vs/config/.gitignore: -------------------------------------------------------------------------------- 1 | /applicationhost.config 2 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc.T4MVC/FluentBootstrap.Mvc.T4MVC.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FluentBootstrap.Mvc.T4MVC 5 | $version$ 6 | FluentBootstrap.Mvc.T4MVC 7 | Dave Glick 8 | Dave Glick 9 | https://github.com/somedave/FluentBootstrap/blob/master/license.txt 10 | http://fluentbootstrap.com/Content/fb-icon.png 11 | http://fluentbootstrap.com 12 | false 13 | Support for T4MVC with FluentBootstrap and ASP.NET MVC. 14 | Copyright 2015 15 | Bootstrap AspNet Mvc AspNetMvc T4MVC 16 | 17 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc.T4MVC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FluentBootstrap.Mvc.T4MVC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dave Glick")] 12 | [assembly: AssemblyProduct("FluentBootstrap.Mvc.T4MVC")] 13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("329bebf9-1682-4469-a5c1-1a01de54df02")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.5.4")] 36 | [assembly: AssemblyFileVersion("3.3.5.4")] 37 | [assembly: AssemblyInformationalVersion("3.3.5.4")] 38 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc.T4MVC/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/FluentBootstrap.Mvc.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FluentBootstrap.Mvc 5 | $version$ 6 | FluentBootstrap.Mvc 7 | Dave Glick 8 | Dave Glick 9 | https://github.com/somedave/FluentBootstrap/blob/master/license.txt 10 | http://fluentbootstrap.com/Content/fb-icon.png 11 | http://fluentbootstrap.com 12 | false 13 | It's what happens when Bootstrap and ASP.NET MVC make sweet, sweet love. Provides HtmlHelpers for the Bootstrap CSS framework. 14 | Copyright 2015 15 | Bootstrap AspNet Mvc AspNetMvc 16 | 17 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Forms/CheckBoxFor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq.Expressions; 4 | using System.Web.Mvc; 5 | using System.Web.Mvc.Html; 6 | using FluentBootstrap.Mvc.Internals; 7 | 8 | namespace FluentBootstrap.Mvc.Forms 9 | { 10 | public class CheckBoxFor : Component 11 | { 12 | private readonly Expression> _expression; 13 | private readonly bool _isNameInLabel; 14 | private string _name; 15 | 16 | internal CheckBoxFor(BootstrapHelper helper, Expression> expression, bool isNameInLabel = true) 17 | : base(helper) 18 | { 19 | _expression = expression; 20 | _isNameInLabel = isNameInLabel; 21 | } 22 | 23 | protected override void OnStart(TextWriter writer) 24 | { 25 | base.OnStart(writer); 26 | 27 | ModelMetadata metadata = ModelMetadata.FromLambdaExpression(_expression, this.GetHtmlHelper().ViewData); 28 | string expressionText = ExpressionHelper.GetExpressionText(_expression); 29 | _name = MvcFormExtensions.GetControlName(this.GetHelper(), expressionText); 30 | string label = MvcFormExtensions.GetControlLabel(metadata, expressionText); 31 | bool isChecked = false; 32 | if (metadata.Model == null || !bool.TryParse(metadata.Model.ToString(), out isChecked)) 33 | { 34 | isChecked = false; 35 | } 36 | writer.Write(_isNameInLabel 37 | ? GetHelper().CheckBox(_name, label, null, isChecked).AddAttribute("value", isChecked) 38 | : GetHelper().CheckBox(_name, null, label, isChecked).AddAttribute("value", isChecked)); 39 | } 40 | 41 | protected override void OnFinish(TextWriter writer) 42 | { 43 | writer.Write(GetHelper().Hidden(_name, false)); 44 | base.OnFinish(writer); 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Forms/FormControlFor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Linq.Expressions; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Web.Mvc; 10 | using System.Web.Mvc.Html; 11 | using FluentBootstrap.Html; 12 | using FluentBootstrap.Forms; 13 | 14 | namespace FluentBootstrap.Mvc.Forms 15 | { 16 | public class FormControlFor : FormControlForBase 17 | { 18 | public FormControlFor(BootstrapHelper helper, bool editor, Expression> expression) 19 | : base(helper, editor, expression) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Forms/FormControlOverride.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Forms; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web.Mvc; 9 | 10 | namespace FluentBootstrap.Mvc.Forms 11 | { 12 | internal class FormControlOverride : ComponentOverride 13 | { 14 | protected override void OnStart(TextWriter writer) 15 | { 16 | string name = Component.GetAttribute("name"); 17 | if (!string.IsNullOrWhiteSpace(name)) 18 | { 19 | // Use a TagBuilder to generate the Id 20 | TagBuilder tagBuilder = new TagBuilder("form"); 21 | string id = Component.GetAttribute("id"); 22 | if (!string.IsNullOrWhiteSpace(id)) 23 | { 24 | tagBuilder.MergeAttribute("id", id); 25 | } 26 | tagBuilder.GenerateId(name); 27 | Component.MergeAttribute("id", tagBuilder.Attributes["id"]); 28 | } 29 | 30 | Component.Prepare(writer); 31 | 32 | // Add the validation data 33 | if (!string.IsNullOrWhiteSpace(name)) 34 | { 35 | // Set the validation class 36 | ModelState modelState; 37 | MvcBootstrapConfig config = (MvcBootstrapConfig)Config; 38 | if (config.HtmlHelper.ViewData.ModelState.TryGetValue(name, out modelState) && modelState.Errors.Count > 0) 39 | { 40 | Component.CssClasses.Add(System.Web.Mvc.HtmlHelper.ValidationInputCssClassName); 41 | } 42 | 43 | // Add other validation attributes 44 | Component.MergeAttributes(config.HtmlHelper.GetUnobtrusiveValidationAttributes(name, null)); 45 | } 46 | 47 | base.OnStart(writer); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Forms/HiddenFor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Linq.Expressions; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web.Mvc.Html; 9 | using FluentBootstrap.Forms; 10 | using FluentBootstrap.Mvc.Internals; 11 | 12 | namespace FluentBootstrap.Mvc.Forms 13 | { 14 | public class HiddenFor : Component 15 | { 16 | private readonly Expression> _expression; 17 | 18 | internal HiddenFor(BootstrapHelper helper, Expression> expression) 19 | : base(helper) 20 | { 21 | _expression = expression; 22 | } 23 | 24 | protected override void OnStart(TextWriter writer) 25 | { 26 | base.OnStart(writer); 27 | writer.Write(this.GetHtmlHelper().HiddenFor(_expression)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Forms/ValidationSummary.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Forms; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Web.Mvc; 9 | using System.Web.Mvc.Html; 10 | using FluentBootstrap.Mvc.Internals; 11 | 12 | namespace FluentBootstrap.Mvc.Forms 13 | { 14 | public class ValidationSummary : FormControl 15 | { 16 | public bool IncludePropertyErrors { get; set; } 17 | 18 | internal ValidationSummary(BootstrapHelper helper) 19 | : base(helper, "div", Css.FormControlStatic, Css.TextDanger) 20 | { 21 | } 22 | 23 | protected override void OnStart(TextWriter writer) 24 | { 25 | base.OnStart(writer); 26 | 27 | // Output the summary 28 | MvcHtmlString validationSummary = this.GetHtmlHelper().ValidationSummary(!IncludePropertyErrors); 29 | if (validationSummary != null) 30 | { 31 | writer.Write(validationSummary.ToString()); 32 | } 33 | 34 | // Indicate to the form that it's been written 35 | Form form = GetComponent
(); 36 | if (form != null) 37 | { 38 | form.GetOverride>().HideValidationSummary = true; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/InternalsExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Web.Mvc; 7 | using FluentBootstrap.Internals; 8 | 9 | namespace FluentBootstrap.Mvc.Internals 10 | { 11 | public static class InternalsExtensions 12 | { 13 | // Convenience methods - these just cast, so make sure they're only used from BootstrapHelpers that are actually MvcBootstrapHelpers 14 | 15 | public static HtmlHelper GetHtmlHelper(this Component component) 16 | { 17 | return ((MvcBootstrapConfig)component.Config).HtmlHelper; 18 | } 19 | 20 | public static MvcBootstrapHelper GetHelper(this Component component) 21 | { 22 | return new MvcBootstrapHelper(component.GetHtmlHelper()); 23 | } 24 | 25 | public static HtmlHelper GetHtmlHelper(this ComponentOverride componentOverride) 26 | { 27 | return ((MvcBootstrapConfig)componentOverride.Config).HtmlHelper; 28 | } 29 | 30 | public static MvcBootstrapHelper GetHelper(this ComponentOverride componentOverride) 31 | { 32 | return new MvcBootstrapHelper(componentOverride.GetHtmlHelper()); 33 | } 34 | 35 | public static HtmlHelper GetHtmlHelper(this MvcBootstrapConfig config) 36 | { 37 | return config.HtmlHelper; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/MvcBootstrapConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web.Mvc; 8 | using FluentBootstrap.Forms; 9 | using FluentBootstrap.Mvc.Forms; 10 | 11 | namespace FluentBootstrap.Mvc 12 | { 13 | public class MvcBootstrapConfig : BootstrapConfig 14 | { 15 | internal HtmlHelper HtmlHelper { get; private set; } 16 | 17 | public MvcBootstrapConfig(HtmlHelper htmlHelper) 18 | { 19 | HtmlHelper = htmlHelper; 20 | } 21 | 22 | protected override void RegisterComponentOverrides() 23 | { 24 | RegisterComponentOverride>(); 25 | RegisterComponentOverride>(); 26 | } 27 | 28 | protected override string GetFullHtmlFieldName(string name) 29 | { 30 | return HtmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name); 31 | } 32 | 33 | protected override TextWriter GetWriter() 34 | { 35 | return HtmlHelper.ViewContext.Writer; 36 | } 37 | 38 | protected override object GetItem(object key, object defaultValue) 39 | { 40 | if (HtmlHelper.ViewContext.HttpContext.Items.Contains(key)) 41 | { 42 | return HtmlHelper.ViewContext.HttpContext.Items[key]; 43 | } 44 | return defaultValue; 45 | } 46 | 47 | protected override void AddItem(object key, object value) 48 | { 49 | HtmlHelper.ViewContext.HttpContext.Items[key] = value; 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/MvcBootstrapHelper.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Forms; 2 | using FluentBootstrap.Mvc.Forms; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Globalization; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Web.Mvc; 11 | 12 | namespace FluentBootstrap.Mvc 13 | { 14 | public class MvcBootstrapHelper : BootstrapHelper, CanCreate> 15 | { 16 | public MvcBootstrapHelper(HtmlHelper htmlHelper) 17 | : base(new MvcBootstrapConfig(htmlHelper)) 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FluentBootstrap.Mvc")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dave Glick")] 12 | [assembly: AssemblyProduct("FluentBootstrap.Mvc")] 13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("508c76cc-4ded-4588-8c2b-80d07d9151fe")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.5.4")] 36 | [assembly: AssemblyFileVersion("3.3.5.4")] 37 | [assembly: AssemblyInformationalVersion("3.3.5.4")] 38 | -------------------------------------------------------------------------------- /FluentBootstrap.Mvc/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/App_Start/RazorGeneratorMvcStart.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using System.Web.WebPages; 4 | using RazorGenerator.Mvc; 5 | 6 | [assembly: WebActivatorEx.PostApplicationStartMethod(typeof(FluentBootstrap.Tests.Web.App_Start.RazorGeneratorMvcStart), "Start")] 7 | 8 | namespace FluentBootstrap.Tests.Web.App_Start { 9 | public static class RazorGeneratorMvcStart { 10 | public static void Start() { 11 | var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) { 12 | UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal 13 | }; 14 | 15 | ViewEngines.Engines.Insert(0, engine); 16 | 17 | // StartPage lookups are done by WebPages. 18 | VirtualPathFactoryManager.RegisterVirtualPathFactory(engine); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace FluentBootstrap.Tests.Web 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | routes.MapRoute("Index", "", new { controller = "Home", action = "Index" }); 16 | routes.MapRoute("Tests", "Tests/{*view}", new { controller = "Tests", action = "Tests" }); 17 | routes.MapRoute("MvcTests", "MvcTests/{*view}", new { controller = "MvcTests", action = "MvcTests" }); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace FluentBootstrap.Tests.Web.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public virtual ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Controllers/MvcTestsController.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Tests.Web.Models.MvcTests; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web; 6 | using System.Web.Mvc; 7 | 8 | namespace FluentBootstrap.Tests.Web.Controllers 9 | { 10 | public class MvcTestsController : Controller 11 | { 12 | public virtual ActionResult MvcTests(string view) 13 | { 14 | ViewModel model = new ViewModel 15 | { 16 | PropA = "A", 17 | PropB = 2, 18 | PropC = "Two", 19 | PropCOptions = new Dictionary() 20 | { 21 | { 1, "One"}, 22 | { 2, "Two"}, 23 | { 3, "Three"} 24 | }, 25 | PropD = true, 26 | Child = new ChildModel() 27 | { 28 | ChildPropA = "Child A" 29 | } 30 | }; 31 | ModelState.AddModelError(string.Empty, "General error message."); 32 | ModelState.AddModelError("PropB", "Property B error message."); 33 | return View(view, model); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Controllers/TestsController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace FluentBootstrap.Tests.Web.Controllers 8 | { 9 | public class TestsController : Controller 10 | { 11 | public virtual ActionResult Tests(string view) 12 | { 13 | return View(view); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="FluentBootstrap.Tests.Web.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace FluentBootstrap.Tests.Web 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | RouteConfig.RegisterRoutes(RouteTable.Routes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Models/MvcTests/ViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace FluentBootstrap.Tests.Web.Models.MvcTests 8 | { 9 | public class ViewModel 10 | { 11 | [Display(Name = "Property A")] 12 | public string PropA { get; set; } 13 | public int PropB { get; set; } 14 | public string PropC { get; set; } 15 | public Dictionary PropCOptions { get; set; } 16 | public bool PropD { get; set; } 17 | public ChildModel Child { get; set; } 18 | } 19 | 20 | public class ChildModel 21 | { 22 | [Display(Name = "Child Property A")] 23 | public string ChildPropA { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FluentBootstrap.Tests.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dave Glick")] 12 | [assembly: AssemblyProduct("FluentBootstrap.Tests.Web")] 13 | [assembly: AssemblyCopyright("Copyright © Dave Glick 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cfb975f2-23e0-4383-82db-e62b932836a1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | FluentBootstrap Tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | @RenderBody() 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Alerts.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("States") 4 | using (Html.Bootstrap().Div().SetId("test-states").Begin()) 5 | { 6 | @Html.Bootstrap().Alert(AlertState.Success, "Success") 7 | @Html.Bootstrap().Alert(AlertState.Info, "Info") 8 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning") 9 | @Html.Bootstrap().Alert(AlertState.Danger, "Danger") 10 | } 11 | 12 |
13 | 14 | @Html.Bootstrap().Heading1("Heading") 15 | using (Html.Bootstrap().Div().SetId("test-heading").Begin()) 16 | { 17 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning", "Yikes, this is a warning.") 18 | } 19 | 20 |
21 | 22 | @Html.Bootstrap().Heading1("Dismissible") 23 | using (Html.Bootstrap().Div().SetId("test-dismissible").Begin()) 24 | { 25 | @Html.Bootstrap().Alert(AlertState.Warning, "Yikes, this is a warning.").SetDismissible() 26 | } 27 | 28 |
29 | 30 | @Html.Bootstrap().Heading1("Dismissible With Heading") 31 | using (Html.Bootstrap().Div().SetId("test-dismissible-with-heading").Begin()) 32 | { 33 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning", "Yikes, this is a warning.").SetDismissible() 34 | } 35 | 36 |
37 | 38 | @Html.Bootstrap().Heading1("Links") 39 | using (Html.Bootstrap().Div().SetId("test-links").Begin()) 40 | { 41 | using(Html.Bootstrap().Alert(AlertState.Warning).SetHeading("Yikes!").Begin()) 42 | { 43 | This is @Html.Bootstrap().Link("link") inside the alert. 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Architecture.cshtml: -------------------------------------------------------------------------------- 1 | @using FluentBootstrap; 2 | 3 | @using (Html.Bootstrap().Container().Begin()) 4 | { 5 | @Html.Bootstrap().Heading1("Alternate Model") 6 | using (Html.Bootstrap().Div().SetId("test-alternate-model").Begin()) 7 | { 8 | var model = new { Foo = "Foo", Bar = true, Baz = 123 }; 9 | using(var form = Html.Bootstrap(model).Form().Begin()) 10 | { 11 | @form.EditorFor(x => x.Foo) 12 | @form.DisplayFor(x => x.Bar) 13 | @form.EditorFor(x => x.Baz) 14 | } 15 | } 16 | 17 |
18 | 19 | @Html.Bootstrap().Heading1("Alternate Begin Syntax") 20 | using (Html.Bootstrap().Div().SetId("test-alternate-begin").Begin()) 21 | { 22 | using (var group = Html.Bootstrap().Begin(x => x.ButtonGroup())) 23 | { 24 | @group.Button("A").SetIcon(Icon.Music) 25 | @group.Button("B") 26 | } 27 | } 28 | } 29 | 30 | @Html.Bootstrap().Heading1("Empty Stack (Issue #1)") 31 | @Html.Bootstrap().Dropdown("My Dropdown") -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Badges.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("Inline") 4 | using (Html.Bootstrap().Div().SetId("test-inline").Begin()) 5 | { 6 |

Badge @Html.Bootstrap().Badge("4")

7 | } 8 | 9 |
10 | 11 | @Html.Bootstrap().Heading1("Link") 12 | using (Html.Bootstrap().Div().SetId("test-link").Begin()) 13 | { 14 |

@Html.Bootstrap().Link("Link").WithChild().Badge("789")

15 | } 16 | 17 |
18 | 19 | @Html.Bootstrap().Heading1("Button") 20 | using (Html.Bootstrap().Div().SetId("test-button").Begin()) 21 | { 22 | @Html.Bootstrap().Button("Button").WithChild().Badge("4") 23 | @Html.Bootstrap().Button("Button").SetState(ButtonState.Primary).WithChild().Badge("456") 24 | } 25 | 26 |
27 | 28 | @Html.Bootstrap().Heading1("Pills") 29 | using (Html.Bootstrap().Div().SetId("test-pills").Begin()) 30 | { 31 | using(var pills = Html.Bootstrap().Pills().Begin()) 32 | { 33 | @pills.Pill("A").WithChild().Badge("3") 34 | @pills.Pill("B").SetActive().WithChild().Badge("5") 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Breadcrumbs.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("Breadcrumb") 4 | using (Html.Bootstrap().Div().SetId("test-breadcrumb").Begin()) 5 | { 6 | using(var breadcrumb = Html.Bootstrap().Breadcrumb().Begin()) 7 | { 8 | @breadcrumb.Crumb("First") 9 | @breadcrumb.Crumb("Second") 10 | @breadcrumb.Crumb("Third").SetActive() 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Icons.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("Inline Icon") 4 | using (Html.Bootstrap().Div().SetId("test-inline-icon").Begin()) 5 | { 6 | This is an inline @Html.Bootstrap().Icon(Icon.ArrowUp) icon. 7 | } 8 | 9 |
10 | 11 | @Html.Bootstrap().Heading1("Button Icon") 12 | using (Html.Bootstrap().Div().SetId("test-button-icon").Begin()) 13 | { 14 | @Html.Bootstrap().Button("Icon Button").SetIcon(Icon.Bell) 15 | } 16 | 17 |
18 | 19 | @Html.Bootstrap().Heading1("Link Button Icon") 20 | using (Html.Bootstrap().Div().SetId("test-link-button-icon").Begin()) 21 | { 22 | @Html.Bootstrap().LinkButton("Link Button").SetIcon(Icon.Picture) 23 | } 24 | 25 |
26 | 27 | @Html.Bootstrap().Heading1("Link Icon") 28 | using (Html.Bootstrap().Div().SetId("test-link-icon").Begin()) 29 | { 30 | @Html.Bootstrap().Link("Link").SetIcon(Icon.Road) 31 | } 32 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Images.cshtml: -------------------------------------------------------------------------------- 1 | @using FluentBootstrap; 2 | 3 | @using (Html.Bootstrap().Container().Begin()) 4 | { 5 | @Html.Bootstrap().Heading1("Images") 6 | using (Html.Bootstrap().Div().SetId("test-images").Begin()) 7 | { 8 | @Html.Bootstrap().Image("http://placehold.it/64x64") 9 | @Html.Bootstrap().Image("http://placehold.it/64x64", "With Alt") 10 | } 11 | 12 |
13 | 14 | @Html.Bootstrap().Heading1("Image Links") 15 | using (Html.Bootstrap().Div().SetId("test-image-links").Begin()) 16 | { 17 | @Html.Bootstrap().Image("http://placehold.it/64x64", "Alt").SetHref("http://www.google.com") 18 | } 19 | 20 |
21 | 22 | @Html.Bootstrap().Heading1("Placeholder") 23 | using (Html.Bootstrap().Div().SetId("test-placeholder").Begin()) 24 | { 25 | @Html.Bootstrap().Placeholder(200, 40).SetText("Placeholder!").SetColors("#800000", "CC0000").SetHref("http://www.google.com").SetAlt("This is my placeholder") 26 | } 27 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Labels.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("Inline") 4 | using (Html.Bootstrap().Div().SetId("test-inline").Begin()) 5 | { 6 |

This is a @Html.Bootstrap().Label("inline") label.

7 | } 8 | 9 |
10 | 11 | @Html.Bootstrap().Heading1("Headers") 12 | using (Html.Bootstrap().Div().SetId("test-headers").Begin()) 13 | { 14 | @Html.Bootstrap().Heading1("A label in a ").WithChild().Label("heading") 15 | using(var heading = Html.Bootstrap().Heading3(null).Begin()) 16 | { 17 | Another heading with a @Html.Bootstrap().Label("label").SetState(LabelState.Danger) 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Links.cshtml: -------------------------------------------------------------------------------- 1 | @using FluentBootstrap; 2 | 3 | @using (Html.Bootstrap().Container().Begin()) 4 | { 5 | @Html.Bootstrap().Heading1("No Pretty Printing") 6 | using (Html.Bootstrap().Div().SetId("test-no-pretty-printing").Begin()) 7 | { 8 | @Html.Bootstrap().Link("Link 1")|@Html.Bootstrap().Link("Link 2") 9 | } 10 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Misc.cshtml: -------------------------------------------------------------------------------- 1 | @Html.Bootstrap().Heading1("Full Width Jumbotron") 2 | @using (Html.Bootstrap().Div().SetId("test-fullwidth-jumbotron").Begin()) 3 | { 4 | using (Html.Bootstrap().Jumbotron().Begin()) 5 | { 6 | using (Html.Bootstrap().Container().Begin()) 7 | { 8 | @Html.Bootstrap().Heading1("Heading") 9 | @Html.Bootstrap().Paragraph("Some text.") 10 | } 11 | } 12 | } 13 | 14 |
15 | 16 | @using (Html.Bootstrap().Container().Begin()) 17 | { 18 | @Html.Bootstrap().Heading1("Jumbotron") 19 | using (Html.Bootstrap().Div().SetId("test-jumbotron").Begin()) 20 | { 21 | using(Html.Bootstrap().Jumbotron().Begin()) 22 | { 23 | @Html.Bootstrap().Heading1("Heading") 24 | @Html.Bootstrap().Paragraph("Some text.") 25 | } 26 | } 27 | 28 |
29 | 30 | @Html.Bootstrap().Heading1("Simple Page Header") 31 | using (Html.Bootstrap().Div().SetId("test-simple-pageheader").Begin()) 32 | { 33 | @Html.Bootstrap().PageHeader("Header").SetSmallText("Small Text") 34 | } 35 | 36 |
37 | 38 | @Html.Bootstrap().Heading1("Complex Page Header") 39 | using (Html.Bootstrap().Div().SetId("test-complex-pageheader").Begin()) 40 | { 41 | using (var pageHeader = Html.Bootstrap().PageHeader().Begin()) 42 | { 43 | Header 44 | @pageHeader.Small("Some small text") 45 | @pageHeader.Label("A label") 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Pagers.cshtml: -------------------------------------------------------------------------------- 1 | @using FluentBootstrap; 2 | 3 | @using (Html.Bootstrap().Container().Begin()) 4 | { 5 | @Html.Bootstrap().Heading1("Manual") 6 | using (Html.Bootstrap().Div().SetId("test-manual").Begin()) 7 | { 8 | using (var pager = Html.Bootstrap().Pager().Begin()) 9 | { 10 | @pager.Page("Older", "http://google.com") 11 | @pager.Page("Archive").SetDisabled() 12 | @pager.Page("Newer") 13 | } 14 | } 15 | 16 |
17 | 18 | @Html.Bootstrap().Heading1("Automatic") 19 | using (Html.Bootstrap().Div().SetId("test-automatic").Begin()) 20 | { 21 | @Html.Bootstrap().Pager().AddPrevious("Oldest").AddPrevious("Old", disabled: true).AddPage("Archive").AddNext("Newer") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Tables.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("Striped") 4 | using (Html.Bootstrap().Div().SetId("test-striped").Begin()) 5 | { 6 | using (var table = Html.Bootstrap(this).Table().SetStyle(TableStyle.Striped).Begin()) 7 | { 8 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username") 9 | @table.TableDataRow("1", "Mark", "Otto", "mdo") 10 | @table.TableDataRow("2", "Jacob", "Thornton", "fat") 11 | } 12 | } 13 | 14 |
15 | 16 | @Html.Bootstrap().Heading1("Explicit Sections") 17 | using (Html.Bootstrap().Div().SetId("test-explicit-sections").Begin()) 18 | { 19 | using (var table = Html.Bootstrap(this).Table().Begin()) 20 | { 21 | using (table.TableHeadSection().Begin()) 22 | { 23 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username") 24 | @table.TableDataRow("1", "Mark", "Otto", "mdo") 25 | } 26 | using (table.TableBodySection().Begin()) 27 | { 28 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username") 29 | @table.TableDataRow("2", "Jacob", "Thornton", "fat") 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/Tests/Tags.cshtml: -------------------------------------------------------------------------------- 1 | @using (Html.Bootstrap().Container().Begin()) 2 | { 3 | @Html.Bootstrap().Heading1("With Child") 4 | using (Html.Bootstrap().Div().SetId("test-with-child").Begin()) 5 | { 6 | @Html.Bootstrap().GridRow().WithChild().GridColumn(12).AddContent("With Child") 7 | } 8 | 9 |
10 | 11 | @Html.Bootstrap().Heading1("With Child Disposable") 12 | using (Html.Bootstrap().Div().SetId("test-with-child-disposable").Begin()) 13 | { 14 | using (Html.Bootstrap().GridRow().WithChild().GridColumn(12).Begin()) 15 | { 16 | With Child Disposable 17 | } 18 | } 19 | 20 |
21 | 22 | @Html.Bootstrap().Heading1("With Child Nested") 23 | using (Html.Bootstrap().Div().SetId("test-with-child-nested").Begin()) 24 | { 25 | using (var row = Html.Bootstrap().Container().WithChild().GridRow().Begin()) 26 | { 27 | using (row.GridColumn(8).Begin()) 28 | { 29 | A 30 | } 31 | @row.GridColumn(4).AddContent("B") 32 | } 33 | } 34 | 35 |
36 | 37 | @Html.Bootstrap().Heading1("Add Child") 38 | using (Html.Bootstrap().Div().SetId("test-add-child").Begin()) 39 | { 40 | @Html.Bootstrap().GridRow().AddChild(x => x.GridColumn(6).AddContent("A")).AddChild(x => x.GridColumn(6).AddContent("B").AddChild(y => Html.Bootstrap().Container())) 41 | } 42 | 43 |
44 | 45 | @Html.Bootstrap().Heading1("AddContent adds a component") 46 | using (Html.Bootstrap().Div().SetId("test-addcontent-adds-component").Begin()) 47 | { 48 | @Html.Bootstrap().Div().AddContent(Html.Bootstrap().Span("span-component")) 49 | } 50 | 51 |
52 | 53 | @Html.Bootstrap().Heading1("AddContentAtEnd adds a component") 54 | using (Html.Bootstrap().Div().SetId("test-addcontentatend-adds-component").Begin()) 55 | { 56 | @Html.Bootstrap().Div().AddContentAtEnd(Html.Bootstrap().Span("span-component1")).AddContentAtEnd(Html.Bootstrap().Span("span-component2")) 57 | } 58 | } -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @using FluentBootstrap; 2 | 3 | @{ 4 | Layout = "~/Views/Shared/_Layout.cshtml"; 5 | } 6 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Views/web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /FluentBootstrap.Tests.Web/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/ArchitectureFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class ArchitectureFixture 12 | { 13 | // Note that the editor/display templates can't be tested properly here because RazorGenerator doesn't support partials 14 | [Test] 15 | public void AlternateModelProducesCorrectHtml() 16 | { 17 | TestHelper.AssertHtml("test-alternate-model", 18 | @" 19 |
20 | 21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 | 31 |
32 |
33 |
34 |
35 |
36 |
37 | "); 38 | } 39 | 40 | [Test] 41 | public void AlternateBeginSyntaxProducesCorrectHtml() 42 | { 43 | TestHelper.AssertHtml("test-alternate-begin", 44 | @"
45 | 48 | 49 |
"); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/BadgesFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class BadgesFixture 12 | { 13 | [Test] 14 | public void InlineBadgeProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-inline", 17 | @"

Badge 18 | 4

"); 19 | } 20 | 21 | [Test] 22 | public void LinkBadgeProducesCorrectHtml() 23 | { 24 | TestHelper.AssertHtml("test-link", 25 | @"

Link 26 | 789

"); 27 | } 28 | 29 | [Test] 30 | public void ButtonBadgeProducesCorrectHtml() 31 | { 32 | TestHelper.AssertHtml("test-button", 33 | @" 36 | "); 39 | } 40 | 41 | [Test] 42 | public void PillsBadgeProducesCorrectHtml() 43 | { 44 | TestHelper.AssertHtml("test-pills", 45 | @""); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/BreadcrumbsFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class BreadcrumbsFixture 12 | { 13 | [Test] 14 | public void BreadcrumbProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-breadcrumb", 17 | @"
    18 |
  1. 19 | First 20 |
  2. 21 |
  3. 22 | Second 23 |
  4. 24 |
  5. Third
  6. 25 |
"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/IconsFixture.cs: -------------------------------------------------------------------------------- 1 | using HtmlAgilityPack; 2 | using NUnit.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace FluentBootstrap.Tests 10 | { 11 | [TestFixture] 12 | public class IconsFixture 13 | { 14 | [Test] 15 | public void InlineIconProducesCorrectHtml() 16 | { 17 | TestHelper.AssertHtml("test-inline-icon", 18 | @"This is an inline 19 | icon."); 20 | } 21 | 22 | [Test] 23 | public void ButtonIconProducesCorrectHtml() 24 | { 25 | TestHelper.AssertHtml("test-button-icon", 26 | @""); 29 | } 30 | 31 | [Test] 32 | public void LinkButtonIconProducesCorrectHtml() 33 | { 34 | TestHelper.AssertHtml("test-link-button-icon", 35 | @" 36 | Link Button 37 | "); 38 | } 39 | 40 | [Test] 41 | public void LinkIconProducesCorrectHtml() 42 | { 43 | TestHelper.AssertHtml("test-link-icon", 44 | @" 45 | Link"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/ImagesFixture.cs: -------------------------------------------------------------------------------- 1 | using HtmlAgilityPack; 2 | using NUnit.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace FluentBootstrap.Tests 10 | { 11 | [TestFixture] 12 | public class ImagesFixture 13 | { 14 | [Test] 15 | public void ImagesProduceCorrectHtml() 16 | { 17 | TestHelper.AssertHtml("test-images", 18 | @" 19 | "); 20 | } 21 | 22 | [Test] 23 | public void ImageLinksProduceCorrectHtml() 24 | { 25 | TestHelper.AssertHtml("test-image-links", 26 | @""); 27 | } 28 | 29 | [Test] 30 | public void PlaceholderProducesCorrectHtml() 31 | { 32 | TestHelper.AssertHtml("test-placeholder", 33 | @""); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/LabelsFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class LabelsFixture 12 | { 13 | [Test] 14 | public void ManualPagerProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-inline", 17 | @"

This is a 18 | inline label.

"); 19 | } 20 | 21 | [Test] 22 | public void AutomaticPagerProducesCorrectHtml() 23 | { 24 | TestHelper.AssertHtml("test-headers", 25 | @"

A label in a 26 | heading 27 |

28 |

Another heading with a 29 | label 30 | 31 |

"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/LinksFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class LinksFixture 12 | { 13 | // Note that the editor/display templates can't be tested properly here because RazorGenerator doesn't support partials 14 | [Test] 15 | public void AlternateModelProducesCorrectHtml() 16 | { 17 | TestHelper.AssertHtml("test-no-pretty-printing", 18 | @"Link 1|Link 2"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/MiscFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class MiscFixture 12 | { 13 | [Test] 14 | public void FullWidthJumbotronProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-fullwidth-jumbotron", 17 | @"
18 |
19 |

Heading

20 |

Some text.

21 |
22 |
"); 23 | } 24 | 25 | [Test] 26 | public void JumbotronProducesCorrectHtml() 27 | { 28 | TestHelper.AssertHtml("test-jumbotron", 29 | @"
30 |

Heading

31 |

Some text.

32 |
"); 33 | } 34 | 35 | [Test] 36 | public void SimplePageHeaderProducesCorrectHtml() 37 | { 38 | TestHelper.AssertHtml("test-simple-pageheader", 39 | @"
40 |

Header 41 | Small Text 42 |

43 |
"); 44 | } 45 | 46 | [Test] 47 | public void ComplexPageHeaderProducesCorrectHtml() 48 | { 49 | TestHelper.AssertHtml("test-complex-pageheader", 50 | @"
51 |

Header 52 | 53 | Some small text 54 | A label 55 |

56 |
"); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/PagersFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class PagersFixture 12 | { 13 | [Test] 14 | public void ManualPagerProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-manual", 17 | @""); 30 | } 31 | 32 | [Test] 33 | public void AutomaticPagerProducesCorrectHtml() 34 | { 35 | TestHelper.AssertHtml("test-automatic", 36 | @""); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FluentBootstrap.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dave Glick")] 12 | [assembly: AssemblyProduct("FluentBootstrap.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f1f9186a-ec3f-42f2-9a02-db83cf203fad")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/SimpleBootstrapHelperFixture.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using NUnit.Framework; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class SimpleBootstrapHelperFixture 12 | { 13 | [Test] 14 | public void SimpleBootstrapHelperProducesCorrectHtmlForInput() 15 | { 16 | // Given 17 | SimpleBootstrapHelper helper = new SimpleBootstrapHelper(); 18 | 19 | // When 20 | string input = helper.Input("input-name", "My Input").ToString().Replace("\r\n", "\n"); 21 | 22 | // Then 23 | Assert.AreEqual(@" 24 | 25 | ".Replace("\r\n", "\n"), input); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/TablesFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Tests 9 | { 10 | [TestFixture] 11 | public class TablesFixture 12 | { 13 | [Test] 14 | public void StripedTableProducesCorrectHtml() 15 | { 16 | TestHelper.AssertHtml("test-striped", 17 | @" 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
#First NameLast NameUsername
1MarkOttomdo
2JacobThorntonfat
"); 41 | } 42 | 43 | [Test] 44 | public void TableWithExplicitSectionsProducesCorrectHtml() 45 | { 46 | TestHelper.AssertHtml("test-explicit-sections", 47 | @" 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
#First NameLast NameUsername
1MarkOttomdo
#First NameLast NameUsername
2JacobThorntonfat
"); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /FluentBootstrap.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FluentBootstrap.WebPages/FluentBootstrap.WebPages.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FluentBootstrap.WebPages 5 | $version$ 6 | FluentBootstrap.WebPages 7 | Dave Glick 8 | Dave Glick 9 | https://github.com/somedave/FluentBootstrap/blob/master/license.txt 10 | http://fluentbootstrap.com/Content/fb-icon.png 11 | http://fluentbootstrap.com 12 | false 13 | Provides HtmlHelpers for the Bootstrap CSS framework in ASP.NET Web Pages. 14 | Copyright 2015 15 | Bootstrap AspNet WebPages AspNetWebPages 16 | 17 | -------------------------------------------------------------------------------- /FluentBootstrap.WebPages/HtmlHelperExtensions.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.WebPages; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web.WebPages; 8 | using System.Web.WebPages.Html; 9 | 10 | namespace FluentBootstrap 11 | { 12 | public static class HtmlHelperExtensions 13 | { 14 | public static WebPagesBootstrapHelper Bootstrap(this HtmlHelper htmlHelper, WebPageBase webPageBase) 15 | { 16 | return new WebPagesBootstrapHelper(webPageBase); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FluentBootstrap.WebPages/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FluentBootstrap.WebPages")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Dave Glick")] 12 | [assembly: AssemblyProduct("FluentBootstrap.WebPages")] 13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0eaf1cd1-b8d5-4813-b510-d285dd42f76b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.5.4")] 36 | [assembly: AssemblyFileVersion("3.3.5.4")] 37 | [assembly: AssemblyInformationalVersion("3.3.5.4")] 38 | -------------------------------------------------------------------------------- /FluentBootstrap.WebPages/WebPagesBootstrapConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web.WebPages; 8 | 9 | namespace FluentBootstrap.WebPages 10 | { 11 | public class WebPagesBootstrapConfig : BootstrapConfig 12 | { 13 | internal WebPageBase WebPageBase { get; private set; } 14 | 15 | public WebPagesBootstrapConfig(WebPageBase webPageBase) 16 | { 17 | WebPageBase = webPageBase; 18 | } 19 | 20 | protected override TextWriter GetWriter() 21 | { 22 | return WebPageBase.Output; 23 | } 24 | 25 | protected override object GetItem(object key, object defaultValue) 26 | { 27 | if (WebPageBase.Context.Items.Contains(key)) 28 | { 29 | return WebPageBase.Context.Items[key]; 30 | } 31 | return defaultValue; 32 | } 33 | 34 | protected override void AddItem(object key, object value) 35 | { 36 | WebPageBase.Context.Items[key] = value; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /FluentBootstrap.WebPages/WebPagesBootstrapHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web; 8 | using System.Web.WebPages; 9 | 10 | namespace FluentBootstrap.WebPages 11 | { 12 | public class WebPagesBootstrapHelper : BootstrapHelper 13 | { 14 | public WebPagesBootstrapHelper(WebPageBase webPageBase) 15 | : base(new WebPagesBootstrapConfig(webPageBase)) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FluentBootstrap.jmconfig: -------------------------------------------------------------------------------- 1 | false -------------------------------------------------------------------------------- /FluentBootstrap/Alerts/Alert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Alerts 9 | { 10 | public class Alert : Tag, IHasTextContent 11 | { 12 | public bool Dismissible { set; get; } 13 | public string Heading { set; get; } 14 | 15 | internal Alert(BootstrapHelper helper) 16 | : base(helper, "div", Css.Alert, Css.AlertInfo) 17 | { 18 | MergeAttribute("role", "alert"); 19 | } 20 | 21 | protected override void OnStart(TextWriter writer) 22 | { 23 | if (Dismissible) 24 | { 25 | AddCss(Css.AlertDismissible); 26 | } 27 | 28 | base.OnStart(writer); 29 | 30 | if (Dismissible) 31 | { 32 | GetHelper().Element("button").AddAttribute("type", "button").AddCss(Css.Close).AddAttribute("data-dismiss", "alert") 33 | .AddChild(_ => GetHelper().Span().AddAttribute("aria-hidden", "true").SetText("\u00D7")) 34 | .AddChild(_ => GetHelper().Span().AddCss(Css.SrOnly).SetText("Close")) 35 | .Component.StartAndFinish(writer); 36 | } 37 | 38 | if (!string.IsNullOrWhiteSpace(Heading)) 39 | { 40 | GetHelper().Strong(Heading + " ").Component.StartAndFinish(writer); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /FluentBootstrap/Alerts/AlertState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap 9 | { 10 | public enum AlertState 11 | { 12 | [Description(Css.AlertSuccess)] 13 | Success, 14 | [Description(Css.AlertInfo)] 15 | Info, 16 | [Description(Css.AlertWarning)] 17 | Warning, 18 | [Description(Css.AlertDanger)] 19 | Danger 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FluentBootstrap/BackgroundState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap 9 | { 10 | public enum BackgroundState 11 | { 12 | [Description(Css.BgPrimary)] 13 | Primary, 14 | [Description(Css.BgSuccess)] 15 | Success, 16 | [Description(Css.BgInfo)] 17 | Info, 18 | [Description(Css.BgWarning)] 19 | Warning, 20 | [Description(Css.BgDanger)] 21 | Danger 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /FluentBootstrap/Badges/Badge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FluentBootstrap.Badges 8 | { 9 | public class Badge : Tag, IHasTextContent 10 | { 11 | internal Badge(BootstrapHelper helper) 12 | : base(helper, "span", Css.Badge) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /FluentBootstrap/Badges/BadgeExtensions.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Badges; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap 9 | { 10 | public static class BadgeExtensions 11 | { 12 | public static ComponentBuilder Badge(this BootstrapHelper helper, object text) 13 | where TConfig : BootstrapConfig 14 | where TComponent : Component, ICanCreate 15 | { 16 | return new ComponentBuilder(helper.Config, new Badge(helper)).SetText(text); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /FluentBootstrap/BootstrapHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace FluentBootstrap 11 | { 12 | public abstract class BootstrapHelper 13 | { 14 | internal abstract BootstrapConfig GetConfig(); 15 | 16 | internal virtual Component GetParent() 17 | { 18 | return null; 19 | } 20 | } 21 | 22 | public abstract class BootstrapHelper : BootstrapHelper 23 | where TConfig : BootstrapConfig 24 | where TComponent : Component 25 | { 26 | private readonly TConfig _config; 27 | 28 | protected BootstrapHelper(TConfig config) 29 | { 30 | _config = config; 31 | } 32 | 33 | internal TConfig Config 34 | { 35 | get { return _config; } 36 | } 37 | 38 | internal override BootstrapConfig GetConfig() 39 | { 40 | return Config; 41 | } 42 | 43 | // This allows an alternate syntax by using a func inside the Begin method 44 | public ComponentWrapper Begin(Func, ComponentBuilder> component) 45 | where TNewComponent : Component 46 | { 47 | return component(this).Begin(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /FluentBootstrap/Breadcrumbs/Breadcrumb.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FluentBootstrap.Breadcrumbs 8 | { 9 | public class Breadcrumb : Tag, 10 | ICanCreate 11 | { 12 | internal Breadcrumb(BootstrapHelper helper) 13 | : base(helper, "ol", Css.Breadcrumb) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /FluentBootstrap/Breadcrumbs/BreadcrumbExtensions.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Breadcrumbs; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap 9 | { 10 | public static class BreadcrumbExtensions 11 | { 12 | public static ComponentBuilder Breadcrumb(this BootstrapHelper helper) 13 | where TConfig : BootstrapConfig 14 | where TComponent : Component, ICanCreate 15 | { 16 | return new ComponentBuilder(helper.Config, new Breadcrumb(helper)); 17 | } 18 | 19 | public static ComponentBuilder Crumb(this BootstrapHelper helper, object text, string href = "#") 20 | where TConfig : BootstrapConfig 21 | where TComponent : Component, ICanCreate 22 | { 23 | return new ComponentBuilder(helper.Config, new Crumb(helper)) 24 | .SetHref(href).SetText(text); 25 | } 26 | 27 | public static ComponentBuilder SetActive(this ComponentBuilder builder, bool active = true) 28 | where TConfig : BootstrapConfig 29 | { 30 | builder.Component.Active = active; 31 | return builder; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FluentBootstrap/Breadcrumbs/Crumb.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Html; 2 | using FluentBootstrap.Links; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace FluentBootstrap.Breadcrumbs 11 | { 12 | public class Crumb : Tag, IHasLinkExtensions, IHasTextContent 13 | { 14 | private Element _listItem = null; 15 | 16 | public bool Active { get; set; } 17 | 18 | internal Crumb(BootstrapHelper helper) 19 | : base(helper, "a") 20 | { 21 | } 22 | 23 | protected override void OnStart(TextWriter writer) 24 | { 25 | // Create the list item wrapper 26 | _listItem = this.GetHelper().Element("li").Component; 27 | if (Active) 28 | { 29 | _listItem.AddCss(Css.Active); 30 | } 31 | _listItem.Start(writer); 32 | 33 | base.OnStart(Active ? new SuppressOutputWriter() : writer); 34 | } 35 | 36 | protected override void OnFinish(TextWriter writer) 37 | { 38 | base.OnFinish(Active ? new SuppressOutputWriter() : writer); 39 | 40 | _listItem.Finish(writer); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /FluentBootstrap/Buttons/Button.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Badges; 2 | using FluentBootstrap.Icons; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace FluentBootstrap.Buttons 11 | { 12 | public class Button : Tag, 13 | IHasIconExtensions, IHasButtonExtensions, IHasButtonStateExtensions, 14 | IHasDisabledAttribute, IHasTextContent, IHasValueAttribute, 15 | ICanCreate 16 | { 17 | private ButtonGroup _buttonGroup; 18 | 19 | internal Button(BootstrapHelper helper, ButtonType buttonType) 20 | : base(helper, "button", Css.Btn, Css.BtnDefault) 21 | { 22 | MergeAttribute("type", buttonType.GetDescription()); 23 | } 24 | 25 | protected override void OnStart(TextWriter writer) 26 | { 27 | // Fix for justified buttons in a group (need to surround them with an extra button group) 28 | // See https://github.com/twbs/bootstrap/issues/12476 29 | ButtonGroup buttonGroup = GetComponent(true); 30 | if (buttonGroup != null && buttonGroup.CssClasses.Contains(Css.BtnGroupJustified)) 31 | { 32 | _buttonGroup = GetHelper().ButtonGroup().Component; 33 | _buttonGroup.Start(writer); 34 | } 35 | 36 | base.OnStart(writer); 37 | } 38 | 39 | protected override void OnFinish(TextWriter writer) 40 | { 41 | base.OnFinish(writer); 42 | 43 | if (_buttonGroup != null) 44 | { 45 | _buttonGroup.Finish(writer); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /FluentBootstrap/Buttons/ButtonGroup.cs: -------------------------------------------------------------------------------- 1 | using FluentBootstrap.Dropdowns; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace FluentBootstrap.Buttons 9 | { 10 | public class ButtonGroup : Tag, 11 | ICanCreate