├── .gitignore ├── BootstrapMvc.sln ├── LICENSE.txt ├── README.md ├── readme-sample.png ├── samples ├── Bootstrap3Mvc5.Sample │ ├── App_Start │ │ ├── FilterConfig.cs │ │ └── RouteConfig.cs │ ├── Bootstrap3Mvc5.Sample.csproj │ ├── Content │ │ ├── Site.css │ │ ├── Site.min.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── Controllers │ │ └── HomeController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ │ └── DemoModelOne.cs │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-2.2.4.intellisense.js │ │ ├── jquery-2.2.4.js │ │ ├── jquery-2.2.4.min.js │ │ └── jquery-2.2.4.min.map │ ├── Views │ │ ├── Home │ │ │ ├── Basics.cshtml │ │ │ ├── Components.cshtml │ │ │ ├── Extend.cshtml │ │ │ ├── Forms.cshtml │ │ │ ├── Index.cshtml │ │ │ ├── Installation.cshtml │ │ │ └── Partial │ │ │ │ ├── Alerts.cshtml │ │ │ │ ├── Badges.cshtml │ │ │ │ ├── Buttons.cshtml │ │ │ │ ├── Icons.cshtml │ │ │ │ ├── Labels.cshtml │ │ │ │ ├── ListGroups.cshtml │ │ │ │ ├── Paging.cshtml │ │ │ │ ├── Panels.cshtml │ │ │ │ └── PartialForm.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── packages.config ├── Bootstrap3Mvc6.Sample │ ├── Bootstrap3Mvc6.Sample.csproj │ ├── Controllers │ │ └── HomeController.cs │ ├── Models │ │ └── DemoModelOne.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Startup.cs │ ├── Views │ │ ├── Home │ │ │ ├── Basics.cshtml │ │ │ ├── Components.cshtml │ │ │ ├── Extend.cshtml │ │ │ ├── Forms.cshtml │ │ │ ├── Index.cshtml │ │ │ ├── Installation.cshtml │ │ │ └── Partial │ │ │ │ ├── Alerts.cshtml │ │ │ │ ├── Badges.cshtml │ │ │ │ ├── Buttons.cshtml │ │ │ │ ├── Icons.cshtml │ │ │ │ ├── Labels.cshtml │ │ │ │ ├── ListGroups.cshtml │ │ │ │ ├── Paging.cshtml │ │ │ │ ├── Panels.cshtml │ │ │ │ └── PartialForm.cshtml │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml │ ├── runtimeconfig.template.json │ └── web.config └── Bootstrap4Mvc6.Sample │ ├── Bootstrap4Mvc6.Sample.csproj │ ├── Controllers │ └── HomeController.cs │ ├── Models │ └── DemoModelOne.cs │ ├── Properties │ └── launchSettings.json │ ├── Startup.cs │ ├── Views │ ├── Home │ │ ├── Basics.cshtml │ │ ├── Components │ │ │ ├── Alerts.cshtml │ │ │ ├── Badges.cshtml │ │ │ ├── Buttons.cshtml │ │ │ ├── ListGroups.cshtml │ │ │ ├── Paging.cshtml │ │ │ └── Panels.cshtml │ │ ├── Extend.cshtml │ │ ├── FormPartial.cshtml │ │ ├── Forms.cshtml │ │ ├── Index.cshtml │ │ └── Installation.cshtml │ ├── Shared │ │ └── _Layout.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml │ ├── runtimeconfig.template.json │ └── web.config ├── src ├── BootstrapMvc.Bootstrap3 │ ├── AnyContentElements │ │ ├── Badge.cs │ │ ├── BadgeExtensions.cs │ │ ├── Label.cs │ │ └── LabelExtensions.cs │ ├── BaseColor.cs │ ├── BootstrapMvc.Bootstrap3.csproj │ ├── Buttons │ │ ├── ButtonExtensions.cs │ │ └── ButtonGroupContent.cs │ ├── Dropdown │ │ ├── DropdownMenu.cs │ │ ├── DropdownMenuContent.cs │ │ ├── DropdownMenuExtensions.cs │ │ ├── DropdownMenuItemDivider.cs │ │ ├── DropdownMenuItemHeader.cs │ │ ├── DropdownMenuItemLink.cs │ │ ├── DropdownMenuParentExtensions.cs │ │ └── IDropdownMenuItem.cs │ ├── ElementExtensions.cs │ ├── Elements │ │ ├── Icon.cs │ │ └── IconExtensions.cs │ ├── EnumToStringConverter.cs │ ├── Grid │ │ ├── GridColExtensions.cs │ │ ├── GridRowContent.cs │ │ └── IGridSizableExtensions.cs │ ├── IconType.cs │ ├── LabelType.cs │ ├── Lists │ │ ├── DefinitionList.cs │ │ ├── DefinitionListContent.cs │ │ └── DefinitionListExtensions.cs │ ├── MessageType.cs │ ├── PaginatorSize.cs │ ├── Paging │ │ ├── Paginator.cs │ │ ├── PaginatorContent.cs │ │ ├── PaginatorExtensions.cs │ │ ├── PaginatorGenerator.cs │ │ ├── PaginatorGeneratorExtensions.cs │ │ └── PaginatorItem.cs │ ├── Panels │ │ ├── EnumToStringConverter.cs │ │ ├── Panel.cs │ │ ├── PanelBody.cs │ │ ├── PanelContent.cs │ │ ├── PanelExtensions.cs │ │ ├── PanelFooter.cs │ │ ├── PanelHeader.cs │ │ └── PanelType.cs │ ├── TextColor.cs │ └── Visibility.cs ├── BootstrapMvc.Bootstrap3Mvc5 │ ├── Bootstrap3Mvc5AnyContentExtensions.cs │ └── BootstrapMvc.Bootstrap3Mvc5.csproj ├── BootstrapMvc.Bootstrap3Mvc6 │ ├── Bootstrap3Mvc6AnyContentExtensions.cs │ └── BootstrapMvc.Bootstrap3Mvc6.csproj ├── BootstrapMvc.Bootstrap4 │ ├── Badge │ │ ├── Badge.cs │ │ ├── BadgeExtensions.cs │ │ ├── BadgeType.cs │ │ └── EnumToStringConverter.cs │ ├── BootstrapMvc.Bootstrap4.csproj │ ├── Grid │ │ ├── GridColExtensions.cs │ │ ├── GridRowContent.cs │ │ └── IGridSizableExtensions.cs │ ├── Label_Replacement │ │ └── LabelExtensions.cs │ └── Table │ │ ├── EnumToStringConverter.cs │ │ ├── TableContent.cs │ │ ├── TableHeader.cs │ │ ├── TableHeaderExtensions.cs │ │ └── TableHeaderStyle.cs ├── BootstrapMvc.Bootstrap4Mvc6 │ ├── Bootstrap4Mvc6AnyContentExtensions.cs │ └── BootstrapMvc.Bootstrap4Mvc6.csproj ├── BootstrapMvc.BootstrapCommon │ ├── Anchor.cs │ ├── AnchorExtensions.cs │ ├── BootstrapMvc.BootstrapCommon.csproj │ ├── Components │ │ ├── Alert │ │ │ ├── Alert.cs │ │ │ ├── AlertExtensions.cs │ │ │ ├── AlertType.cs │ │ │ └── EnumToStringConverter.cs │ │ ├── ButtonGroup │ │ │ ├── ButtonGroup.cs │ │ │ ├── ButtonGroupContent.cs │ │ │ ├── ButtonGroupExtensions.cs │ │ │ ├── ButtonToolbar.cs │ │ │ ├── ButtonToolbarContent.cs │ │ │ └── ButtonToolbarExtensions.cs │ │ ├── Buttons │ │ │ ├── Button.cs │ │ │ ├── ButtonExtensions.cs │ │ │ ├── ButtonSize.cs │ │ │ ├── ButtonType.cs │ │ │ ├── EnumToStringConverter.cs │ │ │ ├── IButtonSizable.cs │ │ │ └── IButtonSizableExtensions.cs │ │ ├── Form_Controls │ │ │ ├── Checkbox.cs │ │ │ ├── CheckboxExtensions.cs │ │ │ ├── EnumToStringConverter.cs │ │ │ ├── IFormControl.cs │ │ │ ├── IInlineDisplay.cs │ │ │ ├── IInlineDisplayExtensions.cs │ │ │ ├── ISelectItem.cs │ │ │ ├── ITextDisplay.cs │ │ │ ├── ITextDisplayExtensions.cs │ │ │ ├── IValueHolder.cs │ │ │ ├── IValueHolderExtensions.cs │ │ │ ├── Input.cs │ │ │ ├── InputExtensions.cs │ │ │ ├── InputType.cs │ │ │ ├── Radio.cs │ │ │ ├── RadioExtensions.cs │ │ │ ├── Select.cs │ │ │ ├── SelectContent.cs │ │ │ ├── SelectExtensions.cs │ │ │ ├── SelectOptGroup.cs │ │ │ ├── SelectOptGroupContent.cs │ │ │ ├── SelectOptGroupExtensions.cs │ │ │ ├── SelectOption.cs │ │ │ ├── SelectOptionExtensions.cs │ │ │ ├── StaticValue.cs │ │ │ ├── StaticValueExtensions.cs │ │ │ ├── Textarea.cs │ │ │ └── TextareaExtensions.cs │ │ ├── Forms │ │ │ ├── ControlContext.cs │ │ │ ├── ControlContextExtensions.cs │ │ │ ├── EnumToStringConverter.cs │ │ │ ├── Fieldset.cs │ │ │ ├── FieldsetExtensions.cs │ │ │ ├── Form.cs │ │ │ ├── FormContentBase.cs │ │ │ ├── FormContentOfT.cs │ │ │ ├── FormEnctype.cs │ │ │ ├── FormExtensions.cs │ │ │ ├── FormGroup.cs │ │ │ ├── FormGroupExtensions.cs │ │ │ ├── FormGroupLabel.cs │ │ │ ├── FormOfT.cs │ │ │ ├── FormType.cs │ │ │ ├── HelpBlock.cs │ │ │ ├── HelpBlockExtensions.cs │ │ │ ├── IFormContext.cs │ │ │ ├── Legend.cs │ │ │ ├── LegendExtensions.cs │ │ │ ├── SubmitMethod.cs │ │ │ ├── ValidationSummary.cs │ │ │ ├── ValidationSummaryExtensions.cs │ │ │ └── ValidationSummaryOfT.cs │ │ └── ListGroups │ │ │ ├── ActionableListGroup.cs │ │ │ ├── ActionableListGroupContent.cs │ │ │ ├── EnumToStringConverter.cs │ │ │ ├── IListGroupElement.cs │ │ │ ├── IListGroupElementExtensions.cs │ │ │ ├── ListGroupButtonItem.cs │ │ │ ├── ListGroupExtensions.cs │ │ │ ├── ListGroupItemType.cs │ │ │ ├── ListGroupLinkItem.cs │ │ │ ├── ListGroupSimpleItem.cs │ │ │ ├── OrdinaryListGroup.cs │ │ │ └── OrdinaryListGroupContent.cs │ ├── DateInputMode.cs │ ├── IActivable.cs │ ├── IActivableExtensions.cs │ ├── IDisableable.cs │ ├── IDisableableExtensions.cs │ ├── IDropdownMenuParentMarker.cs │ ├── IPlaceholderTarget.cs │ ├── Layout │ │ ├── Grid │ │ │ ├── GridCol.cs │ │ │ ├── GridColExtensions.cs │ │ │ ├── GridRow.cs │ │ │ ├── GridRowContent.cs │ │ │ ├── GridRowExtensions.cs │ │ │ ├── GridSize.cs │ │ │ ├── IGridSizable.cs │ │ │ └── IGridSizableExtensions.cs │ │ └── Table │ │ │ ├── EnumToStringConverter.cs │ │ │ ├── Table.cs │ │ │ ├── TableBody.cs │ │ │ ├── TableCaption.cs │ │ │ ├── TableCell.cs │ │ │ ├── TableCellExtensions.cs │ │ │ ├── TableContent.cs │ │ │ ├── TableExtensions.cs │ │ │ ├── TableFooter.cs │ │ │ ├── TableHeader.cs │ │ │ ├── TableHeaderCell.cs │ │ │ ├── TableRow.cs │ │ │ ├── TableRowCellColor.cs │ │ │ ├── TableRowContent.cs │ │ │ ├── TableRowExtensions.cs │ │ │ ├── TableSection.cs │ │ │ ├── TableSectionContent.cs │ │ │ ├── TableSectionExtensions.cs │ │ │ └── TableStyles.cs │ ├── MarkersExtensions.cs │ ├── OrdinaryElementExtensions.cs │ └── Typography │ │ └── List │ │ ├── List.cs │ │ ├── ListContent.cs │ │ ├── ListExtensions.cs │ │ └── ListType.cs ├── BootstrapMvc.Core │ ├── AnyContentElementExtensions.cs │ ├── BootstrapMvc.Core.csproj │ ├── Core │ │ ├── AnyContent.cs │ │ ├── AnyContentElement.cs │ │ ├── ContentElementOfT.cs │ │ ├── DisposableContent.cs │ │ ├── Element.cs │ │ ├── IAnyContentMarker.cs │ │ ├── IAnyContentMarkerOfT.cs │ │ ├── IBootstrapContext.cs │ │ ├── IBootstrapContextOfT.cs │ │ ├── IControlContext.cs │ │ ├── IItemWriter.cs │ │ ├── IItemWriterOfT.cs │ │ ├── IItemWriterOfTAndTContent.cs │ │ ├── ILink.cs │ │ ├── IModelValidationError.cs │ │ ├── IModelValidationResult.cs │ │ ├── ITagBuilder.cs │ │ ├── IWritable.cs │ │ ├── IWritableItem.cs │ │ ├── IWritingHelper.cs │ │ ├── IWritingHelperOfT.cs │ │ ├── OrdinaryElement.cs │ │ ├── SimpleBlock.cs │ │ ├── WritableItem.cs │ │ └── _Classes.cd │ ├── ElementExtensions.cs │ ├── IAnyContentMarkerExtensions.cs │ ├── IControlContextExtensions.cs │ ├── LinkExtensions.cs │ └── WritableItemExtensions.cs ├── BootstrapMvc.Mvc5 │ ├── BootstrapHelper.cs │ ├── BootstrapHelperOfT.cs │ ├── BootstrapMvc.Mvc5.csproj │ ├── BootstrapViewPage.cs │ ├── BootstrapViewPageT.cs │ ├── ItemWriterOfT.cs │ ├── ItemWriterOfTAndTContent.cs │ ├── ModelValidationError.cs │ ├── ModelValidationResult.cs │ ├── Mvc5LinkExtensions.cs │ └── TagBuilder.cs └── BootstrapMvc.Mvc6 │ ├── BootstrapHelper.cs │ ├── BootstrapHelperOfT.cs │ ├── BootstrapMvc.Mvc6.csproj │ ├── ItemWriterOfT.cs │ ├── ItemWriterOfTAndTContent.cs │ ├── ModelValidationError.cs │ ├── ModelValidationResult.cs │ ├── Mvc6LinkExtensions.cs │ └── TagBuilder.cs └── test ├── BootstrapMvc.Bootstrap3.Tests ├── BootstrapMvc.Bootstrap3.Tests.xproj ├── FormsTest.cs ├── IconTest.cs ├── PanelsTest.cs ├── TablesTest.cs ├── TestBase.cs ├── project.json └── project.lock.json ├── BootstrapMvc.Core.Tests ├── BootstrapMvc.Core.Tests.xproj ├── ContentElementTests.cs ├── ContentTests.cs ├── DisposableContentTests.cs ├── DummyWritableBlock.cs ├── WritableBlockTests.cs ├── project.json └── project.lock.json └── BootstrapMvc.Mvc5.Tests ├── BootstrapContextTests.cs ├── BootstrapMvc.Mvc5.Tests.xproj ├── LinkExtensionsTest.cs ├── TagBuilderTests.cs ├── project.json └── project.lock.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.nupkg 2 | *.suo 3 | *.user 4 | /TestResults 5 | /packages 6 | StyleCop.Cache 7 | bin 8 | obj 9 | /.vs 10 | /artifacts -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015 Dmitry Popov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /readme-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/readme-sample.png -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace Bootstrap3Mvc5.Sample 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/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 Bootstrap3Mvc5.Sample 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Content/Site.css: -------------------------------------------------------------------------------- 1 | /* Set padding to keep content from hitting the edges */ 2 | .body-content { 3 | padding-left: 15px; 4 | padding-right: 15px; 5 | } 6 | 7 | /* Override the default bootstrap behavior where horizontal description lists 8 | will truncate terms that are too long to fit in the left column 9 | */ 10 | .dl-horizontal dt { 11 | white-space: normal; 12 | } 13 | 14 | /* Set width on the form input elements since they're 100% wide by default */ 15 | input, 16 | select, 17 | textarea { 18 | max-width: 280px; 19 | } 20 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Content/Site.min.css: -------------------------------------------------------------------------------- 1 | .body-content{padding-left:15px;padding-right:15px}.dl-horizontal dt{white-space:normal}input,select,textarea{max-width:280px} -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Bootstrap3Mvc5.Sample.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/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 Bootstrap3Mvc5.Sample 9 | { 10 | public class MvcApplication : System.Web.HttpApplication 11 | { 12 | protected void Application_Start() 13 | { 14 | AreaRegistration.RegisterAllAreas(); 15 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 16 | RouteConfig.RegisterRoutes(RouteTable.Routes); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Models/DemoModelOne.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Bootstrap3Mvc5.Sample.Models 4 | { 5 | public class DemoModelOne 6 | { 7 | public string StringField { get; set; } 8 | 9 | public bool BooleanField { get; set; } 10 | 11 | public int IntegerField { get; set; } 12 | 13 | public DateTimeOffset DateTimeOffsetField { get; set; } 14 | 15 | public string FieldWithError { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/Scripts/_references.js -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Basics.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Basics of BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Components.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Components"; 3 | 4 | Html.RenderPartial("Partial/Alerts"); 5 | Html.RenderPartial("Partial/Badges"); 6 | Html.RenderPartial("Partial/Icons"); 7 | Html.RenderPartial("Partial/Labels"); 8 | Html.RenderPartial("Partial/Buttons"); 9 | Html.RenderPartial("Partial/ListGroups"); 10 | Html.RenderPartial("Partial/Panels"); 11 | Html.RenderPartial("Partial/Paging"); 12 | } 13 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Extend.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Extending BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Installation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "BootstrapMvc: Installation"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

1. Install NuGet package

8 | 9 |

10 | Install BootstrapMvc.Bootstrap3Mvc5 11 | package from NuGet to your ASP.MVC5 project:

Install-Package BootstrapMvc.Bootstrap3Mvc5 12 |

13 | 14 | 15 |

2. Update Views\Web.config file

16 | 17 |

18 | Modify your Views\Web.config file (and all Areas\<Area>\Views\Web.config too), 19 | replace base class for views (in <system.web.webPages.razor> section):
20 | instead:
<pages pageBaseType="System.Web.Mvc.WebViewPage">
21 | write:
<pages pageBaseType="BootstrapMvc.Mvc5.BootstrapViewPage">
22 |

23 |

And add one more namespace to namespaces list: <add namespace="BootstrapMvc" />

24 | 25 |

3. Clean and Rebuild your project

26 | 27 |

Clean and Rebuild you project to activate changes and activate intellisence. Rarely, a Visual Studio restart helps.

-------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Partial/Badges.cshtml: -------------------------------------------------------------------------------- 1 | 

Badges

2 | 3 | @using (Bootstrap.BeginGridRow()) 4 | { 5 | using (Bootstrap.BeginGridCol(0, 7, 7, 7)) 6 | { 7 |
 8 | @@Bootstrap.Badge("42") 
 9 | @@Bootstrap.Badge(MvcHtmlString.Create("To be or <s>not</s> to be?"))
10 | @@Bootstrap.Badge("Hello World!").Content(Bootstrap.Icon(IconType.Gift))
11 | 
12 | } 13 | using (Bootstrap.BeginGridCol(0, 5, 5, 5)) 14 | { 15 | @Bootstrap.Badge("42") 16 | @Bootstrap.Badge(MvcHtmlString.Create("To be or not to be?")) 17 | @Bootstrap.Badge("Hello World!").Content(Bootstrap.Icon(IconType.Gift)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Partial/Icons.cshtml: -------------------------------------------------------------------------------- 1 | 

Icons

2 | 3 |

All icons are identified via enum, you do not need to write classes as strings.

4 | @using (Bootstrap.BeginGridRow()) 5 | { 6 | using (Bootstrap.BeginGridCol(0, 7, 7, 7)) 7 | { 8 |
 9 | @@Bootstrap.Icon(IconType.Arrow_Down) 
10 | @@Bootstrap.Icon(IconType.Arrow_Left) 
11 | @@Bootstrap.Icon(IconType.Arrow_Up) 
12 | @@Bootstrap.Icon(IconType.Arrow_Right)
13 | 
14 | } 15 | using (Bootstrap.BeginGridCol(0, 5, 5, 5)) 16 | { 17 | @Bootstrap.Icon(IconType.Arrow_Down) 18 | @Bootstrap.Icon(IconType.Arrow_Left) 19 | @Bootstrap.Icon(IconType.Arrow_Up) 20 | @Bootstrap.Icon(IconType.Arrow_Right) 21 | } 22 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Home/Partial/PartialForm.cshtml: -------------------------------------------------------------------------------- 1 | @model Bootstrap3Mvc5.Sample.Models.DemoModelOne 2 | @{ 3 | using (Bootstrap.BeginFormFieldset("Fieldset in partial subview")) 4 | { 5 | using (Bootstrap.FormGroupFor(m => m.StringField).Label("Field with complex content").WithSizedControls().BeginContent()) 6 | { 7 | @Bootstrap.Input().Size(6, 6, 6, 6) 8 | @Bootstrap.HelpBlock("Some text about this control") 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | Error 10 | 11 | 12 |
13 |

Error.

14 |

An error occurred while processing your request.

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/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 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/favicon.ico -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justdmitry/BootstrapMvc/dc38cfd87bcc45bc5ec6f5b8eaa31a12f89aa0ac/samples/Bootstrap3Mvc5.Sample/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc5.Sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Bootstrap3Mvc6.Sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp1.0 5 | true 6 | Bootstrap3Mvc6.Sample 7 | Exe 8 | Bootstrap3Mvc6.Sample 9 | 1.0.4 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Models/DemoModelOne.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Bootstrap3Mvc6.Sample.Models 4 | { 5 | public class DemoModelOne 6 | { 7 | public string StringField { get; set; } 8 | 9 | public bool BooleanField { get; set; } 10 | 11 | public int IntegerField { get; set; } 12 | 13 | public DateTimeOffset DateTimeOffsetField { get; set; } = DateTimeOffset.Now; 14 | 15 | public string FieldWithError { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:33453/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNET_ENV": "Development" 16 | } 17 | }, 18 | "web": { 19 | "commandName": "web", 20 | "launchBrowser": true, 21 | "launchUrl": "http://localhost:5000", 22 | "environmentVariables": { 23 | "Hosting:Environment": "Development" 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Basics.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Basics of BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Components.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Components"; 3 | 4 | await Html.RenderPartialAsync("Partial/Alerts"); 5 | await Html.RenderPartialAsync("Partial/Badges"); 6 | await Html.RenderPartialAsync("Partial/Icons"); 7 | await Html.RenderPartialAsync("Partial/Labels"); 8 | await Html.RenderPartialAsync("Partial/Buttons"); 9 | await Html.RenderPartialAsync("Partial/ListGroups"); 10 | await Html.RenderPartialAsync("Partial/Panels"); 11 | await Html.RenderPartialAsync("Partial/Paging"); 12 | } 13 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Extend.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Extending BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Installation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "BootstrapMvc: Installation"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

1. Add dependency to project.json

8 | 9 |
10 | "dependencies": {
11 |     ....
12 |     "BootstrapMvc.Bootstrap3Mvc6": "2.1.0"
13 | }
14 | 
15 | 16 |

2. Update Views\_ViewImports.cshtml file

17 | 18 |

19 | Add two lines to Views\_ViewImports.cshtml file: 20 |

@@using BootstrapMvc
21 | @@inject BootstrapMvc.Mvc6.BootstrapHelper<TModel> Bootstrap
22 |

23 | 24 |

3. Register in DI container

25 | 26 |

27 | Append to ConfigureServices() method in Startup.cs: 28 |

services.AddTransient(typeof(BootstrapMvc.Mvc6.BootstrapHelper<>));
29 |

30 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Partial/Badges.cshtml: -------------------------------------------------------------------------------- 1 | 

Badges

2 | 3 | @using (Bootstrap.BeginGridRow()) 4 | { 5 | using (Bootstrap.BeginGridCol(0, 7, 7, 7)) 6 | { 7 |
 8 | @@Bootstrap.Badge("42") 
 9 | @@Bootstrap.Badge(new HtmlString("To be or <s>not</s> to be?"))
10 | @@Bootstrap.Badge("Hello World!").Content(Bootstrap.Icon(IconType.Gift))
11 | 
12 | } 13 | using (Bootstrap.BeginGridCol(0, 5, 5, 5)) 14 | { 15 | @Bootstrap.Badge("42") 16 | @Bootstrap.Badge(new HtmlString("To be or not to be?")) 17 | @Bootstrap.Badge("Hello World!").Content(Bootstrap.Icon(IconType.Gift)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Partial/Icons.cshtml: -------------------------------------------------------------------------------- 1 | 

Icons

2 | 3 |

All icons are identified via enum, you do not need to write classes as strings.

4 | @using (Bootstrap.BeginGridRow()) 5 | { 6 | using (Bootstrap.BeginGridCol(0, 7, 7, 7)) 7 | { 8 |
 9 | @@Bootstrap.Icon(IconType.Arrow_Down) 
10 | @@Bootstrap.Icon(IconType.Arrow_Left) 
11 | @@Bootstrap.Icon(IconType.Arrow_Up) 
12 | @@Bootstrap.Icon(IconType.Arrow_Right)
13 | 
14 | } 15 | using (Bootstrap.BeginGridCol(0, 5, 5, 5)) 16 | { 17 | @Bootstrap.Icon(IconType.Arrow_Down) 18 | @Bootstrap.Icon(IconType.Arrow_Left) 19 | @Bootstrap.Icon(IconType.Arrow_Up) 20 | @Bootstrap.Icon(IconType.Arrow_Right) 21 | } 22 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/Home/Partial/PartialForm.cshtml: -------------------------------------------------------------------------------- 1 | @model Bootstrap3Mvc6.Sample.Models.DemoModelOne 2 | @{ 3 | using (Bootstrap.BeginFormFieldset("Fieldset in partial subview")) 4 | { 5 | using (Bootstrap.FormGroupFor(m => m.StringField).Label("Field with complex content").WithSizedControls().BeginContent()) 6 | { 7 | @Bootstrap.Input().Size(6, 6, 6, 6) 8 | @Bootstrap.HelpBlock("Some text about this control") 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BootstrapMvc 2 | @using Microsoft.AspNetCore.Html; 3 | @inject BootstrapMvc.Mvc6.BootstrapHelper Bootstrap -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "gcServer": true 3 | } -------------------------------------------------------------------------------- /samples/Bootstrap3Mvc6.Sample/web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Bootstrap4Mvc6.Sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp1.0 5 | true 6 | Bootstrap4Mvc6.Sample 7 | Exe 8 | Bootstrap4Mvc6.Sample 9 | 1.0.4 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Models/DemoModelOne.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace Bootstrap4Mvc6.Sample.Models 5 | { 6 | public class DemoModelOne 7 | { 8 | [Display(Name = "Some string")] 9 | public string StringField { get; set; } 10 | 11 | [Display(Name = "Some bool")] 12 | public bool BooleanField { get; set; } 13 | 14 | [Display(Name = "Some int")] 15 | public int IntegerField { get; set; } 16 | 17 | public DateTimeOffset DateTimeOffsetField { get; set; } = DateTimeOffset.Now; 18 | 19 | public string FieldWithError { get; set; } 20 | 21 | public bool BooleanFieldWithError { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:65412/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "/", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Bootstrap4Mvc6.Sample": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "http://localhost:5000", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "Development" 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/Home/Basics.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Basics of BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/Home/Extend.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Extending BootstrapMvc"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

This page is under construction

-------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/Home/FormPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model Bootstrap4Mvc6.Sample.Models.DemoModelOne 2 | @{ 3 | using (Bootstrap.BeginFormFieldset("Fieldset in partial subview")) 4 | { 5 | using (Bootstrap.FormGroupFor(m => m.StringField).Label("Field with complex content").WithSizedControls().BeginContent()) 6 | { 7 | @Bootstrap.Input().Size(6, 6, 6, 6, 6) 8 | @Bootstrap.HelpBlock("Some text about this control") 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/Home/Installation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "BootstrapMvc: Installation"; 3 | } 4 | 5 |

@ViewBag.Title

6 | 7 |

1. Add dependency to project.json

8 | 9 |
10 | "dependencies": {
11 |     ....
12 |     "BootstrapMvc.Bootstrap4Mvc6": "1.0.0"
13 | }
14 | 
15 | 16 |

2. Update Views\_ViewImports.cshtml file

17 | 18 |

19 | Add two lines to Views\_ViewImports.cshtml file: 20 |

@@using BootstrapMvc
21 | @@inject BootstrapMvc.Mvc6.BootstrapHelper<TModel> Bootstrap
22 |

23 | 24 |

3. Register in DI container

25 | 26 |

27 | Append to ConfigureServices() method in Startup.cs: 28 |

services.AddTransient(typeof(BootstrapMvc.Mvc6.BootstrapHelper<>));
29 |

30 | -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BootstrapMvc 2 | @using Microsoft.AspNetCore.Html; 3 | @inject BootstrapMvc.Mvc6.BootstrapHelper Bootstrap -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "gcServer": true 3 | } -------------------------------------------------------------------------------- /samples/Bootstrap4Mvc6.Sample/web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/AnyContentElements/Badge.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class Badge : AnyContentElement 6 | { 7 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 8 | { 9 | var tb = Helper.CreateTagBuilder("span"); 10 | tb.AddCssClass("badge"); 11 | 12 | ApplyCss(tb); 13 | ApplyAttributes(tb); 14 | 15 | tb.WriteStartTag(writer); 16 | 17 | return tb.GetEndTag(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/AnyContentElements/BadgeExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static class BadgeExtensions 7 | { 8 | #region Generation 9 | 10 | public static IItemWriter Badge(this IAnyContentMarker contentHelper, object content) 11 | { 12 | return contentHelper.CreateWriter().Content(content); 13 | } 14 | 15 | #endregion 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/AnyContentElements/Label.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class Label : AnyContentElement 6 | { 7 | public LabelType Type { get; set; } 8 | 9 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 10 | { 11 | var tb = Helper.CreateTagBuilder("span"); 12 | tb.AddCssClass(Type.ToCssClass()); 13 | 14 | ApplyCss(tb); 15 | ApplyAttributes(tb); 16 | 17 | tb.WriteStartTag(writer); 18 | 19 | return tb.GetEndTag(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/AnyContentElements/LabelExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static class LabelExtensions 7 | { 8 | #region Fluent 9 | 10 | public static IItemWriter Type(this IItemWriter target, LabelType value) where T : Label 11 | { 12 | target.Item.Type = value; 13 | return target; 14 | } 15 | 16 | #endregion 17 | 18 | #region Generation 19 | 20 | public static IItemWriter Label(this IAnyContentMarker contentHelper, LabelType type) 21 | { 22 | return contentHelper.CreateWriter().Type(type); 23 | } 24 | 25 | public static IItemWriter Label(this IAnyContentMarker contentHelper, LabelType type, object content) 26 | { 27 | return contentHelper.CreateWriter().Type(type).Content(content); 28 | } 29 | 30 | public static IItemWriter Label(this IAnyContentMarker contentHelper, LabelType type, params object[] contents) 31 | { 32 | return contentHelper.CreateWriter().Type(type).Content(contents); 33 | } 34 | 35 | public static AnyContent BeginLabel(this IAnyContentMarker contentHelper, LabelType type) 36 | { 37 | return Label(contentHelper, type).BeginContent(); 38 | } 39 | 40 | #endregion 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/BaseColor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum BaseColor 6 | { 7 | DefaultNone, 8 | PrimaryBlue, 9 | SuccessGreen, 10 | InfoCyan, 11 | WarningOrange, 12 | DangerRed 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/BootstrapMvc.Bootstrap3.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Copyright © Dmitry Popov, 2015 5 | BootstrapMvc.Bootstrap3 6 | 2.7.0 7 | netstandard1.3;net451 8 | $(DefineConstants);BOOTSTRAP3 9 | BootstrapMvc.Bootstrap3 10 | BootstrapMvc.Bootstrap3 11 | Bootstrap;Bootstrap3;Mvc;HtmlHelpers 12 | ListGroup added 13 | https://github.com/justdmitry/BootstrapMvc 14 | git 15 | https://github.com/justdmitry/BootstrapMvc.git 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Buttons/ButtonExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Buttons; 6 | using BootstrapMvc.Elements; 7 | 8 | public static partial class ButtonExtensions 9 | { 10 | #region Generation 11 | 12 | public static IItemWriter Button(this IAnyContentMarker contentHelper, IconType iconType) 13 | { 14 | return contentHelper.CreateWriter().Content(contentHelper.CreateWriter().Type(iconType)); 15 | } 16 | 17 | public static IItemWriter Button(this IAnyContentMarker contentHelper, IconType iconType, object content) 18 | { 19 | return contentHelper.CreateWriter().Content(contentHelper.CreateWriter().Type(iconType), content); 20 | } 21 | 22 | public static IItemWriter Button(this IAnyContentMarker contentHelper, ButtonType type, IconType iconType) 23 | { 24 | return contentHelper.CreateWriter().Type(type).Content(contentHelper.CreateWriter().Type(iconType)); 25 | } 26 | 27 | public static IItemWriter Button(this IAnyContentMarker contentHelper, ButtonType type, IconType iconType, object content) 28 | { 29 | return contentHelper.CreateWriter().Type(type).Content(contentHelper.CreateWriter().Type(iconType), content); 30 | } 31 | 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Buttons/ButtonGroupContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Buttons 2 | { 3 | using BootstrapMvc.Core; 4 | using BootstrapMvc.Elements; 5 | 6 | public partial class ButtonGroupContent : DisposableContent 7 | { 8 | public IItemWriter Button(IconType iconType) 9 | { 10 | var btn = Button(); 11 | btn.Content(Context.Helper.CreateWriter(btn.Item).Type(iconType)); 12 | return btn; 13 | } 14 | 15 | public IItemWriter Button(IconType iconType, object content) 16 | { 17 | return Button(iconType).Content(content); 18 | } 19 | 20 | public IItemWriter Button(ButtonType type, IconType iconType) 21 | { 22 | return Button(iconType).Type(type); 23 | } 24 | 25 | public IItemWriter Button(ButtonType type, IconType iconType, object content) 26 | { 27 | return Button(iconType).Type(type).Content(content); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/DropdownMenu.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Dropdown 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class DropdownMenu : ContentElement 7 | { 8 | public bool RightAlign { get; set; } 9 | 10 | protected override DropdownMenuContent CreateContentContext(IBootstrapContext context) 11 | { 12 | return new DropdownMenuContent(context, this); 13 | } 14 | 15 | protected override void WriteSelfStart(System.IO.TextWriter writer) 16 | { 17 | var tb = Helper.CreateTagBuilder("ul"); 18 | tb.AddCssClass("dropdown-menu"); 19 | if (RightAlign) 20 | { 21 | tb.AddCssClass("dropdown-menu-right"); 22 | } 23 | tb.MergeAttribute("role", "menu", true); 24 | 25 | ApplyCss(tb); 26 | ApplyAttributes(tb); 27 | 28 | tb.WriteStartTag(writer); 29 | } 30 | 31 | protected override void WriteSelfEnd(System.IO.TextWriter writer) 32 | { 33 | writer.Write(""); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/DropdownMenuExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BootstrapMvc.Core; 3 | using BootstrapMvc.Dropdown; 4 | 5 | namespace BootstrapMvc 6 | { 7 | public static class DropdownMenuExtensions 8 | { 9 | public static IItemWriter RightAlign(this IItemWriter target, bool value = true) 10 | where T : DropdownMenu 11 | { 12 | target.Item.RightAlign = value; 13 | return target; 14 | } 15 | 16 | #region Generating 17 | 18 | public static IItemWriter DropdownMenu(this IAnyContentMarker contentHelper) 19 | { 20 | return contentHelper.CreateWriter(); 21 | } 22 | 23 | #endregion 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/DropdownMenuItemDivider.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Dropdown 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class DropdownMenuItemDivider : Element, IDropdownMenuItem 7 | { 8 | protected override void WriteSelf(System.IO.TextWriter writer) 9 | { 10 | var tb = Helper.CreateTagBuilder("li"); 11 | tb.AddCssClass("divider"); 12 | tb.MergeAttribute("role", "presentation", true); 13 | 14 | tb.WriteFullTag(writer); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/DropdownMenuItemHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BootstrapMvc.Core; 3 | 4 | namespace BootstrapMvc.Dropdown 5 | { 6 | public class DropdownMenuItemHeader : AnyContentElement, IDropdownMenuItem 7 | { 8 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 9 | { 10 | var tb = Helper.CreateTagBuilder("li"); 11 | tb.AddCssClass("dropdown-header"); 12 | tb.MergeAttribute("role", "presentation", true); 13 | 14 | tb.WriteStartTag(writer); 15 | 16 | return tb.GetEndTag(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/DropdownMenuItemLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BootstrapMvc.Core; 3 | 4 | namespace BootstrapMvc.Dropdown 5 | { 6 | public class DropdownMenuItemLink : AnyContentElement, IDropdownMenuItem, ILink, IDisableable 7 | { 8 | public string HrefValue { get; set; } 9 | 10 | public bool DisabledValue { get; set; } 11 | 12 | void IDisableable.SetDisabled(bool disabled) 13 | { 14 | DisabledValue = disabled; 15 | } 16 | 17 | bool IDisableable.Disabled() 18 | { 19 | return DisabledValue; 20 | } 21 | 22 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 23 | { 24 | var tb = Helper.CreateTagBuilder("li"); 25 | tb.MergeAttribute("role", "presentation", true); 26 | if (DisabledValue) 27 | { 28 | tb.AddCssClass("disabled"); 29 | } 30 | 31 | tb.WriteStartTag(writer); 32 | 33 | var a = Helper.CreateTagBuilder("a"); 34 | a.MergeAttribute("role", "menuitem", true); 35 | a.MergeAttribute("tabindex", "-1", true); 36 | a.MergeAttribute("href", DisabledValue ? "#" : HrefValue, true); 37 | 38 | a.WriteStartTag(writer); 39 | 40 | return ""; 41 | } 42 | 43 | void ILink.SetHref(string value) 44 | { 45 | HrefValue = value; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Dropdown/IDropdownMenuItem.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Dropdown 2 | { 3 | using System; 4 | 5 | public interface IDropdownMenuItem 6 | { 7 | // Nothing 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Elements/Icon.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Elements 2 | { 3 | using BootstrapMvc; 4 | using BootstrapMvc.Core; 5 | 6 | public class Icon : Element 7 | { 8 | public IconType Type { get; set; } 9 | 10 | public bool NoSpacing { get; set; } 11 | 12 | protected override void WriteSelf(System.IO.TextWriter writer) 13 | { 14 | var tb = Helper.CreateTagBuilder("i"); 15 | tb.AddCssClass(Type.ToCssClass()); 16 | 17 | ApplyCss(tb); 18 | ApplyAttributes(tb); 19 | 20 | if (!NoSpacing) 21 | { 22 | writer.Write(" "); 23 | } 24 | 25 | tb.WriteFullTag(writer); 26 | 27 | if (!NoSpacing) 28 | { 29 | writer.Write(" "); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Elements/IconExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Elements; 6 | 7 | public static partial class IconExtensions 8 | { 9 | #region Fluent 10 | 11 | public static IItemWriter Type(this IItemWriter target, IconType value) where T : Icon 12 | { 13 | target.Item.Type = value; 14 | return target; 15 | } 16 | 17 | public static IItemWriter NoSpacing(this IItemWriter target, bool value = true) where T :Icon 18 | { 19 | target.Item.NoSpacing = value; 20 | return target; 21 | } 22 | 23 | #endregion 24 | 25 | public static IItemWriter Icon(this IAnyContentMarker contentHelper, IconType type) 26 | { 27 | return contentHelper.CreateWriter().Type(type); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Grid/GridColExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Grid; 6 | 7 | public static partial class GridColExtensions 8 | { 9 | public static IItemWriter Offset(this IItemWriter target, byte xs, byte sm, byte md, byte lg) where T : GridCol 10 | { 11 | target.Item.Offset = new GridSize(xs, sm, md, lg); 12 | return target; 13 | } 14 | 15 | public static IItemWriter GridCol(this IAnyContentMarker contentHelper, byte xs, byte sm, byte md, byte lg) 16 | { 17 | return contentHelper.CreateWriter().Size(new GridSize(xs, sm, md, lg)); 18 | } 19 | 20 | public static AnyContent BeginGridCol(this IAnyContentMarker contentHelper, byte xs, byte sm, byte md, byte lg) 21 | { 22 | return GridCol(contentHelper, xs, sm, md, lg).BeginContent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Grid/GridRowContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Grid 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public partial class GridRowContent : DisposableContent 7 | { 8 | public IItemWriter Col(byte xs, byte sm, byte md, byte lg) 9 | { 10 | return Context.Helper.CreateWriter(Parent) 11 | .Size(new GridSize(xs, sm, md, lg)); 12 | } 13 | 14 | public AnyContent BeginCol(byte xs, byte sm, byte md, byte lg) 15 | { 16 | return Col(xs, sm, md, lg).BeginContent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Grid/IGridSizableExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static partial class IGridSizableExtensions 7 | { 8 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg) 9 | where T : IGridSizable, IWritableItem 10 | { 11 | target.Item.SetSize(new GridSize(xs, sm, md, lg)); 12 | return target; 13 | } 14 | 15 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg) 16 | where T : ContentElement, IGridSizable 17 | where TContent : DisposableContent 18 | { 19 | target.Item.SetSize(new GridSize(xs, sm, md, lg)); 20 | return target; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/LabelType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum LabelType 6 | { 7 | DefaultGray, 8 | PrimaryBlue, 9 | SuccessGreen, 10 | WarningOrange, 11 | DangerRed, 12 | InfoCyan 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Lists/DefinitionList.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Lists 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class DefinitionList : ContentElement 7 | { 8 | public bool Horizontal { get; set; } 9 | 10 | protected override DefinitionListContent CreateContentContext(IBootstrapContext context) 11 | { 12 | return new DefinitionListContent(context, this); 13 | } 14 | 15 | protected override void WriteSelfStart(System.IO.TextWriter writer) 16 | { 17 | var tb = Helper.CreateTagBuilder("dl"); 18 | if (Horizontal) 19 | { 20 | tb.AddCssClass("dl-horizontal"); 21 | } 22 | 23 | ApplyCss(tb); 24 | ApplyAttributes(tb); 25 | 26 | tb.WriteStartTag(writer); 27 | } 28 | 29 | protected override void WriteSelfEnd(System.IO.TextWriter writer) 30 | { 31 | writer.Write(""); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Lists/DefinitionListContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Lists 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class DefinitionListContent : DisposableContent 7 | { 8 | public DefinitionListContent(IBootstrapContext context, DefinitionList parent) 9 | { 10 | this.Context = context; 11 | this.Parent = parent; 12 | } 13 | 14 | private IBootstrapContext Context { get; set; } 15 | 16 | private DefinitionList Parent { get; set; } 17 | 18 | public IItemWriter Name(object content) 19 | { 20 | var res = Context.Helper.CreateWriter(Parent).Content(content); 21 | res.Item.TagName = "dt"; 22 | return res; 23 | } 24 | 25 | public IItemWriter Value(object content) 26 | { 27 | var res = Context.Helper.CreateWriter(Parent).Content(content); 28 | res.Item.TagName = "dd"; 29 | return res; 30 | } 31 | 32 | public IItemWriter Value(params object[] contents) 33 | { 34 | var res = Context.Helper.CreateWriter(Parent).Content(contents); 35 | res.Item.TagName = "dd"; 36 | return res; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Lists/DefinitionListExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Lists; 6 | 7 | public static class DefinitionListExtensions 8 | { 9 | #region Fluent 10 | 11 | public static IItemWriter Horizontal(this IItemWriter target, bool value = true) where T : DefinitionList 12 | { 13 | target.Item.Horizontal = value; 14 | return target; 15 | } 16 | 17 | #endregion 18 | 19 | #region Generation 20 | 21 | public static IItemWriter DefinitionList(this IAnyContentMarker contentHelper) 22 | { 23 | return contentHelper.CreateWriter(); 24 | } 25 | 26 | public static DefinitionListContent BeginDefinitionList(this IAnyContentMarker contentHelper) 27 | { 28 | return DefinitionList(contentHelper).BeginContent(); 29 | } 30 | 31 | public static DefinitionListContent BeginDefinitionList(this IAnyContentMarker contentHelper, bool horizontal) 32 | { 33 | return DefinitionList(contentHelper).Horizontal(horizontal).BeginContent(); 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/MessageType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum MessageType 6 | { 7 | ValidationResultErrorsFoundHeader, 8 | ValidationResultErrorsFoundFooter, 9 | ValidationResultWarningnsFoundHeader, 10 | ValidationResultWarningnsFoundFooter 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/PaginatorSize.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum PaginatorSize 6 | { 7 | Default, 8 | Large, 9 | Small 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Paging/Paginator.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Paging 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class Paginator : ContentElement 7 | { 8 | public PaginatorSize Size { get; set; } 9 | 10 | protected override PaginatorContent CreateContentContext(IBootstrapContext context) 11 | { 12 | return new PaginatorContent(context, this); 13 | } 14 | 15 | protected override void WriteSelfStart(System.IO.TextWriter writer) 16 | { 17 | writer.Write(""); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Paging/PaginatorContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Paging 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class PaginatorContent : DisposableContent 6 | { 7 | public PaginatorContent(IBootstrapContext context, Paginator parent) 8 | { 9 | this.Context = context; 10 | this.Parent = parent; 11 | } 12 | 13 | private IBootstrapContext Context { get; set; } 14 | 15 | private Paginator Parent { get; set; } 16 | 17 | public IItemWriter Item(object content) 18 | { 19 | return Context.Helper.CreateWriter(Parent).Content(content); 20 | } 21 | 22 | public IItemWriter ItemNext() 23 | { 24 | return Item("»"); 25 | } 26 | 27 | public IItemWriter ItemPrevious() 28 | { 29 | return Item("«"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Paging/PaginatorItem.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Paging 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class PaginatorItem : AnyContentElement, ILink, IDisableable, IActivable 7 | { 8 | public string Href { get; set; } 9 | 10 | public bool Disabled { get; set; } 11 | 12 | public bool Active { get; set; } 13 | 14 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 15 | { 16 | var li = Helper.CreateTagBuilder("li"); 17 | 18 | if (Disabled) 19 | { 20 | li.AddCssClass("disabled"); 21 | } 22 | else 23 | { 24 | if (Active) 25 | { 26 | li.AddCssClass("active"); 27 | } 28 | } 29 | 30 | li.WriteStartTag(writer); 31 | 32 | var link = Helper.CreateTagBuilder(Disabled ? "span" : "a"); 33 | if (!Disabled) 34 | { 35 | link.MergeAttribute("href", Href, true); 36 | } 37 | 38 | link.WriteStartTag(writer); 39 | 40 | return link.GetEndTag() + li.GetEndTag(); 41 | } 42 | 43 | void ILink.SetHref(string value) 44 | { 45 | Href = value; 46 | } 47 | 48 | void IDisableable.SetDisabled(bool disabled) 49 | { 50 | Disabled = disabled; 51 | } 52 | 53 | bool IDisableable.Disabled() 54 | { 55 | return Disabled; 56 | } 57 | 58 | void IActivable.SetActive(bool active) 59 | { 60 | Active = active; 61 | } 62 | 63 | bool IActivable.Active() 64 | { 65 | return Active; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public static partial class EnumToStringConverter 6 | { 7 | public static string ToCssClass(this PanelType type) 8 | { 9 | switch (type) 10 | { 11 | case PanelType.PrimaryBlue: 12 | return "panel panel-primary"; 13 | case PanelType.SuccessGreen: 14 | return "panel panel-success"; 15 | case PanelType.InfoCyan: 16 | return "panel panel-info"; 17 | case PanelType.WarningOrange: 18 | return "panel panel-warning"; 19 | case PanelType.DangerRed: 20 | return "panel panel-danger"; 21 | case PanelType.DefaultGray: 22 | default: 23 | return "panel panel-default"; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/Panel.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Panels 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class Panel : ContentElement 7 | { 8 | public PanelHeader PanelHeader { get; set; } 9 | 10 | public PanelBody PanelBody { get; set; } 11 | 12 | public PanelFooter PanelFooter { get; set; } 13 | 14 | public PanelType Type { get; set; } 15 | 16 | protected override PanelContent CreateContentContext(IBootstrapContext context) 17 | { 18 | return new PanelContent(context, this); 19 | } 20 | 21 | protected override void WriteSelfStart(System.IO.TextWriter writer) 22 | { 23 | var tb = Helper.CreateTagBuilder("div"); 24 | tb.AddCssClass(Type.ToCssClass()); 25 | 26 | ApplyCss(tb); 27 | ApplyAttributes(tb); 28 | 29 | tb.WriteStartTag(writer); 30 | 31 | if (PanelHeader != null) 32 | { 33 | PanelHeader.Parent = this; 34 | PanelHeader.WriteTo(writer); 35 | } 36 | if (PanelBody != null) 37 | { 38 | PanelBody.Parent = this; 39 | PanelBody.WriteTo(writer); 40 | } 41 | } 42 | 43 | protected override void WriteSelfEnd(System.IO.TextWriter writer) 44 | { 45 | if (PanelFooter != null) 46 | { 47 | PanelFooter.Parent = this; 48 | PanelFooter.WriteTo(writer); 49 | } 50 | writer.Write(""); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/PanelBody.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Panels 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class PanelBody : AnyContentElement 6 | { 7 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 8 | { 9 | var tb = Helper.CreateTagBuilder("div"); 10 | tb.AddCssClass("panel-body"); 11 | 12 | ApplyCss(tb); 13 | ApplyAttributes(tb); 14 | 15 | tb.WriteStartTag(writer); 16 | 17 | return tb.GetEndTag(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/PanelFooter.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Panels 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class PanelFooter : AnyContentElement 6 | { 7 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 8 | { 9 | var tb = Helper.CreateTagBuilder("div"); 10 | tb.AddCssClass("panel-footer"); 11 | 12 | ApplyCss(tb); 13 | ApplyAttributes(tb); 14 | 15 | tb.WriteStartTag(writer); 16 | 17 | return tb.GetEndTag(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/PanelHeader.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Panels 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class PanelHeader : AnyContentElement 6 | { 7 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 8 | { 9 | var tb = Helper.CreateTagBuilder("div"); 10 | tb.AddCssClass("panel-heading"); 11 | 12 | ApplyCss(tb); 13 | ApplyAttributes(tb); 14 | 15 | tb.WriteStartTag(writer); 16 | 17 | return tb.GetEndTag(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Panels/PanelType.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public enum PanelType 6 | { 7 | DefaultGray, 8 | PrimaryBlue, 9 | SuccessGreen, 10 | InfoCyan, 11 | WarningOrange, 12 | DangerRed 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/TextColor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum TextColor 6 | { 7 | DefaultNone, 8 | PrimaryBlue, 9 | SuccessGreen, 10 | InfoCyan, 11 | WarningOrange, 12 | DangerRed, 13 | MutedGray 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3/Visibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum Visibility 6 | { 7 | /// 8 | /// Normal visibility ('display: block') 9 | /// 10 | Visible, 11 | 12 | /// 13 | /// Hidden, but use space ('visibility:hidden', 'display' not modified) 14 | /// 15 | Invisible, 16 | 17 | /// 18 | /// Hidden ('display: none') 19 | /// 20 | Hidden 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3Mvc5/Bootstrap3Mvc5AnyContentExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web.Mvc; 7 | using BootstrapMvc.Controls; 8 | using BootstrapMvc.Core; 9 | 10 | public static class Bootstrap3Mvc5AnyContentExtensions 11 | { 12 | public static IItemWriter Select(this IAnyContentMarker contentHelper, IEnumerable items) 13 | { 14 | var select = contentHelper.Select(); 15 | select.Item.Items = items.Select(x => SelectListItemToSelectOption(contentHelper.Context, x)); 16 | return select; 17 | } 18 | 19 | private static SelectOption SelectListItemToSelectOption(IBootstrapContext context, SelectListItem item) 20 | { 21 | return context.Helper.CreateWriter(null).Value(item.Value).Disabled(item.Disabled).Content(item.Text).Item; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3Mvc5/BootstrapMvc.Bootstrap3Mvc5.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Copyright © Dmitry Popov, 2015 5 | BootstrapMvc.Bootstrap3Mvc5 6 | 2.3.1 7 | net451 8 | BootstrapMvc.Bootstrap3Mvc5 9 | BootstrapMvc.Bootstrap3Mvc5 10 | Bootstrap;Bootstrap3;Mvc;Mvc5;HelpHelpers 11 | BootstrapMvc.Bootstrap3 updated to 2.7.0 12 | https://github.com/justdmitry/BootstrapMvc 13 | git 14 | https://github.com/justdmitry/BootstrapMvc.git 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3Mvc6/Bootstrap3Mvc6AnyContentExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Microsoft.AspNetCore.Mvc.Rendering; 7 | 8 | using BootstrapMvc; 9 | using BootstrapMvc.Controls; 10 | using BootstrapMvc.Core; 11 | 12 | public static class Bootstrap3Mvc6AnyContentExtensions 13 | { 14 | public static IItemWriter Select(this IAnyContentMarker contentHelper, IEnumerable items) 15 | { 16 | var select = contentHelper.Select(); 17 | select.Item.Items = items.Select(x => SelectListItemToSelectOption(contentHelper.Context, x)); 18 | return select; 19 | } 20 | 21 | private static SelectOption SelectListItemToSelectOption(IBootstrapContext context, SelectListItem item) 22 | { 23 | return context.Helper.CreateWriter(null).Value(item.Value).Disabled(item.Disabled).Content(item.Text).Item; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap3Mvc6/BootstrapMvc.Bootstrap3Mvc6.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Copyright © Dmitry Popov, 2015 5 | BootstrapMvc.Bootstrap3Mvc6 6 | 2.4.1 7 | netstandard1.6;net451 8 | BootstrapMvc.Bootstrap3Mvc6 9 | BootstrapMvc.Bootstrap3Mvc6 10 | Bootstrap;Bootstrap3;Mvc;Mvc6;HelpHelpers 11 | BootstrapMvc.Bootstrap3 updated to 2.7.0 12 | https://github.com/justdmitry/BootstrapMvc 13 | git 14 | https://github.com/justdmitry/BootstrapMvc.git 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Badge/Badge.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class Badge : AnyContentElement 6 | { 7 | public BadgeType Type { get; set; } 8 | 9 | #if BOOTSTRAP4 10 | public bool Pill { get; set; } 11 | #endif 12 | 13 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 14 | { 15 | var tb = Helper.CreateTagBuilder("span"); 16 | tb.AddCssClass(Type.ToCssClass()); 17 | 18 | #if BOOTSTRAP4 19 | if (Pill) 20 | { 21 | tb.AddCssClass("tag-pill"); 22 | } 23 | #endif 24 | 25 | ApplyCss(tb); 26 | ApplyAttributes(tb); 27 | 28 | tb.WriteStartTag(writer); 29 | 30 | return tb.GetEndTag(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Badge/BadgeExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static class BadgeExtensions 7 | { 8 | #region Fluent 9 | 10 | public static IItemWriter Type(this IItemWriter target, BadgeType value) where T : Badge 11 | { 12 | target.Item.Type = value; 13 | return target; 14 | } 15 | 16 | #if BOOTSTRAP4 17 | public static IItemWriter Pill(this IItemWriter target, bool value = true) where T : Badge 18 | { 19 | target.Item.Pill = value; 20 | return target; 21 | } 22 | #endif 23 | 24 | #endregion 25 | 26 | #region Generation 27 | 28 | public static IItemWriter Badge(this IAnyContentMarker contentHelper, BadgeType type) 29 | { 30 | return contentHelper.CreateWriter().Type(type); 31 | } 32 | 33 | public static IItemWriter Badge(this IAnyContentMarker contentHelper, BadgeType type, object content) 34 | { 35 | return contentHelper.CreateWriter().Type(type).Content(content); 36 | } 37 | 38 | public static IItemWriter Badge(this IAnyContentMarker contentHelper, BadgeType type, params object[] contents) 39 | { 40 | return contentHelper.CreateWriter().Type(type).Content(contents); 41 | } 42 | 43 | public static AnyContent BeginBadge(this IAnyContentMarker contentHelper, BadgeType type) 44 | { 45 | return Badge(contentHelper, type).BeginContent(); 46 | } 47 | 48 | #endregion 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Badge/BadgeType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum BadgeType 6 | { 7 | DefaultGray, 8 | PrimaryBlue, 9 | SuccessGreen, 10 | WarningOrange, 11 | DangerRed, 12 | InfoCyan 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Badge/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public static partial class EnumToStringConverter 6 | { 7 | public static string ToCssClass(this BadgeType type) 8 | { 9 | // String concatenation will be optimized at compile time 10 | const string prefix = "badge badge-"; 11 | switch (type) 12 | { 13 | case BadgeType.DefaultGray: 14 | return prefix + "default"; 15 | case BadgeType.PrimaryBlue: 16 | return prefix + "primary"; 17 | case BadgeType.SuccessGreen: 18 | return prefix + "success"; 19 | case BadgeType.WarningOrange: 20 | return prefix + "warning"; 21 | case BadgeType.DangerRed: 22 | return prefix + "danger"; 23 | case BadgeType.InfoCyan: 24 | return prefix + "info"; 25 | default: 26 | return string.Empty; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/BootstrapMvc.Bootstrap4.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Copyright © Dmitry Popov, 2016 5 | BootstrapMvc.Bootstrap4 6 | 1.2.0 7 | netstandard1.3;net451 8 | $(DefineConstants);BOOTSTRAP4 9 | BootstrapMvc.Bootstrap4 10 | BootstrapMvc.Bootstrap4 11 | Bootstrap;Bootstrap4;Mvc;HtmlHelpers 12 | ListGroup added, Label now Badge (again) 13 | https://github.com/justdmitry/BootstrapMvc 14 | git 15 | https://github.com/justdmitry/BootstrapMvc.git 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Grid/GridRowContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Grid 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public partial class GridRowContent : DisposableContent 7 | { 8 | [Obsolete("Use method with 'xl' param")] 9 | public IItemWriter Col(byte xs, byte sm, byte md, byte lg) 10 | { 11 | return Col(xs, sm, md, lg, lg); 12 | } 13 | 14 | public IItemWriter Col(byte xs, byte sm, byte md, byte lg, byte xl) 15 | { 16 | return Context.Helper.CreateWriter(Parent) 17 | .Size(new GridSize(xs, sm, md, lg, xl)); 18 | } 19 | 20 | [Obsolete("Use method with 'xl' param")] 21 | public AnyContent BeginCol(byte xs, byte sm, byte md, byte lg) 22 | { 23 | return BeginCol(xs, sm, md, lg, lg); 24 | } 25 | 26 | public AnyContent BeginCol(byte xs, byte sm, byte md, byte lg, byte xl) 27 | { 28 | return Col(xs, sm, md, lg, xl).BeginContent(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Grid/IGridSizableExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static partial class IGridSizableExtensions 7 | { 8 | [Obsolete("Use method with 'xl' param")] 9 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg) 10 | where T : IGridSizable, IWritableItem 11 | { 12 | return Size(target, xs, sm, md, lg, lg); 13 | } 14 | 15 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg, byte xl) 16 | where T : IGridSizable, IWritableItem 17 | { 18 | target.Item.SetSize(new GridSize(xs, sm, md, lg, xl)); 19 | return target; 20 | } 21 | 22 | [Obsolete("Use method with 'xl' param")] 23 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg) 24 | where T : ContentElement, IGridSizable 25 | where TContent : DisposableContent 26 | { 27 | return Size(target, xs, sm, md, lg, lg); 28 | } 29 | 30 | public static IItemWriter Size(this IItemWriter target, byte xs, byte sm, byte md, byte lg, byte xl) 31 | where T : ContentElement, IGridSizable 32 | where TContent : DisposableContent 33 | { 34 | target.Item.SetSize(new GridSize(xs, sm, md, lg, xl)); 35 | return target; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Label_Replacement/LabelExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static class LabelExtensions 7 | { 8 | [Obsolete("Use Badge instead")] 9 | public static IItemWriter Label(this IAnyContentMarker contentHelper, object content) 10 | { 11 | return contentHelper.CreateWriter().Type(BadgeType.DefaultGray).Content(content); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Table/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public static partial class EnumToStringConverter 6 | { 7 | public static string ToCssClass(this TableHeaderStyle style) 8 | { 9 | switch (style) 10 | { 11 | case TableHeaderStyle.Inverse: 12 | return "thead-inverse"; 13 | case TableHeaderStyle.DefaultGray: 14 | return "thead-default"; 15 | case TableHeaderStyle.None: 16 | default: 17 | return string.Empty; 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Table/TableContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Tables 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public partial class TableContent 7 | { 8 | public IItemWriter Header(TableHeaderStyle style) 9 | { 10 | return Context.Helper.CreateWriter(Parent).Style(style); 11 | } 12 | 13 | public TableSectionContent BeginHeader(TableHeaderStyle style) 14 | { 15 | return Header(style).BeginContent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Table/TableHeader.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Tables 2 | { 3 | using System; 4 | using System.IO; 5 | 6 | public partial class TableHeader 7 | { 8 | public TableHeaderStyle Style { get; set; } 9 | 10 | protected override void WriteSelfStart(TextWriter writer) 11 | { 12 | AddCssClass(Style.ToCssClass()); 13 | 14 | base.WriteSelfStart(writer); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Table/TableHeaderExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using BootstrapMvc.Core; 4 | using BootstrapMvc.Tables; 5 | 6 | public static class TableHeaderExtensions 7 | { 8 | public static IItemWriter Style(this IItemWriter target, TableHeaderStyle value) 9 | where T : TableHeader 10 | { 11 | target.Item.Style = value; 12 | return target; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4/Table/TableHeaderStyle.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public enum TableHeaderStyle : byte 6 | { 7 | None = 0, 8 | Inverse = 1, 9 | DefaultGray = 2 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4Mvc6/Bootstrap4Mvc6AnyContentExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using Microsoft.AspNetCore.Mvc.Rendering; 7 | 8 | using BootstrapMvc; 9 | using BootstrapMvc.Controls; 10 | using BootstrapMvc.Core; 11 | 12 | public static class Bootstrap4Mvc6AnyContentExtensions 13 | { 14 | public static IItemWriter Select(this IAnyContentMarker contentHelper, IEnumerable items) 15 | { 16 | var select = contentHelper.Select(); 17 | select.Item.Items = items.Select(x => SelectListItemToSelectOption(contentHelper.Context, x)); 18 | return select; 19 | } 20 | 21 | private static SelectOption SelectListItemToSelectOption(IBootstrapContext context, SelectListItem item) 22 | { 23 | return context.Helper.CreateWriter(null).Value(item.Value).Disabled(item.Disabled).Content(item.Text).Item; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/BootstrapMvc.Bootstrap4Mvc6/BootstrapMvc.Bootstrap4Mvc6.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Copyright © Dmitry Popov, 2016 5 | BootstrapMvc.Bootstrap4Mvc6 6 | 1.1.1 7 | netstandard1.6;net451 8 | BootstrapMvc.Bootstrap4Mvc6 9 | BootstrapMvc.Bootstrap4Mvc6 10 | Bootstrap;Bootstrap4;Mvc;Mvc6;HelpHelpers 11 | BootstrapMvc.Bootstrap4 updated to 1.2.0 12 | https://github.com/justdmitry/BootstrapMvc 13 | git 14 | https://github.com/justdmitry/BootstrapMvc.git 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Anchor.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Dropdown; 6 | 7 | public class Anchor : AnyContentElement, ILink, IDropdownMenuParentMarker 8 | { 9 | public string Href { get; set; } 10 | 11 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 12 | { 13 | var tb = Helper.CreateTagBuilder("a"); 14 | tb.MergeAttribute("href", Href, true); 15 | 16 | ApplyCss(tb); 17 | ApplyAttributes(tb); 18 | 19 | tb.WriteStartTag(writer); 20 | 21 | return tb.GetEndTag(); 22 | } 23 | 24 | void ILink.SetHref(string value) 25 | { 26 | Href = value; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/AnchorExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public static class AnchorExtensions 7 | { 8 | public static IItemWriter Anchor(this IAnyContentMarker contentHelper) 9 | { 10 | return contentHelper.CreateWriter(); 11 | } 12 | 13 | public static IItemWriter Anchor(this IAnyContentMarker contentHelper, object content) 14 | { 15 | return contentHelper.CreateWriter().Content(content); 16 | } 17 | 18 | public static IItemWriter Anchor(this IAnyContentMarker contentHelper, params object[] contents) 19 | { 20 | return contentHelper.CreateWriter().Content(contents); 21 | } 22 | 23 | public static AnyContent BeginAnchor(this IAnyContentMarker contentHelper) 24 | { 25 | return contentHelper.CreateWriter().BeginContent(); 26 | } 27 | 28 | public static IItemWriter Link(this IAnyContentMarker contentHelper) 29 | { 30 | return Anchor(contentHelper); 31 | } 32 | 33 | public static IItemWriter Link(this IAnyContentMarker contentHelper, object content) 34 | { 35 | return Anchor(contentHelper, content); 36 | } 37 | 38 | public static IItemWriter Link(this IAnyContentMarker contentHelper, params object[] contents) 39 | { 40 | return Anchor(contentHelper, contents); 41 | } 42 | 43 | public static AnyContent BeginLink(this IAnyContentMarker contentHelper) 44 | { 45 | return BeginAnchor(contentHelper); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/BootstrapMvc.BootstrapCommon.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard1.3;net451 5 | BootstrapMvc.BootstrapCommon 6 | BootstrapMvc.BootstrapCommon 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Alert/Alert.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public class Alert : AnyContentElement 6 | { 7 | public AlertType Type { get; set; } 8 | 9 | public bool Closable { get; set; } 10 | 11 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 12 | { 13 | var tb = Helper.CreateTagBuilder("div"); 14 | tb.AddCssClass(Type.ToCssClass()); 15 | if (Closable) 16 | { 17 | tb.AddCssClass("alert-dismissable"); 18 | } 19 | tb.MergeAttribute("role", "alert", true); 20 | 21 | ApplyCss(tb); 22 | ApplyAttributes(tb); 23 | 24 | tb.WriteStartTag(writer); 25 | 26 | if (Closable) 27 | { 28 | var dsmb = Helper.CreateTagBuilder("button"); 29 | dsmb.MergeAttribute("type", "button", true); 30 | dsmb.MergeAttribute("class", "close", true); 31 | dsmb.MergeAttribute("data-dismiss", "alert", true); 32 | #if BOOTSTRAP3 33 | dsmb.MergeAttribute("aria-hidden", "true", true); 34 | dsmb.InnerHtml = "×"; 35 | #endif 36 | #if BOOTSTRAP4 37 | dsmb.InnerHtml = "×"; 38 | #endif 39 | dsmb.WriteFullTag(writer); 40 | } 41 | 42 | return tb.GetEndTag(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Alert/AlertType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public enum AlertType 6 | { 7 | WarningOrange, 8 | DangerRed, 9 | SuccessGreen, 10 | InfoCyan 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Alert/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BootstrapMvc 4 | { 5 | public static partial class EnumToStringConverter 6 | { 7 | public static string ToCssClass(this AlertType type) 8 | { 9 | switch (type) 10 | { 11 | case AlertType.DangerRed: 12 | return "alert alert-danger"; 13 | case AlertType.InfoCyan: 14 | return "alert alert-info"; 15 | case AlertType.SuccessGreen: 16 | return "alert alert-success"; 17 | case AlertType.WarningOrange: 18 | return "alert alert-warning"; 19 | } 20 | return string.Empty; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/ButtonGroup/ButtonGroupContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Buttons 2 | { 3 | using BootstrapMvc.Core; 4 | 5 | public partial class ButtonGroupContent : DisposableContent 6 | { 7 | public ButtonGroupContent(IBootstrapContext context, ButtonGroup parent) 8 | { 9 | this.Context = context; 10 | this.Parent = parent; 11 | } 12 | 13 | private IBootstrapContext Context { get; set; } 14 | 15 | private ButtonGroup Parent { get; set; } 16 | 17 | #region ButtonGroup 18 | 19 | public IItemWriter ButtonGroup() 20 | { 21 | return Context.Helper.CreateWriter(Parent); 22 | } 23 | 24 | public ButtonGroupContent BeginButtonGroup() 25 | { 26 | return ButtonGroup().BeginContent(); 27 | } 28 | 29 | #endregion 30 | 31 | #region Button 32 | 33 | public IItemWriter Button() 34 | { 35 | return Context.Helper.CreateWriter(Parent); 36 | } 37 | 38 | public IItemWriter Button(object content) 39 | { 40 | return Button().Content(content); 41 | } 42 | 43 | public IItemWriter Button(ButtonType type, object content) 44 | { 45 | return Button().Type(type).Content(content); 46 | } 47 | 48 | public IItemWriter Button(ButtonType type, params object[] contents) 49 | { 50 | return Button().Type(type).Content(contents); 51 | } 52 | 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/ButtonGroup/ButtonToolbarContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Buttons 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class ButtonToolbarContent : DisposableContent 7 | { 8 | public ButtonToolbarContent(IBootstrapContext context, ButtonToolbar parent) 9 | { 10 | this.Context = context; 11 | } 12 | 13 | private IBootstrapContext Context { get; set; } 14 | 15 | private ButtonToolbar Parent { get; set; } 16 | 17 | #region ButtonGroup 18 | 19 | public IItemWriter ButtonGroup() 20 | { 21 | return Context.Helper.CreateWriter(Parent); 22 | } 23 | 24 | public IItemWriter ButtonGroup(ButtonSize size) 25 | { 26 | return ButtonGroup().Size(size); 27 | } 28 | 29 | public ButtonGroupContent BeginButtonGroup() 30 | { 31 | return ButtonGroup().BeginContent(); 32 | } 33 | 34 | public ButtonGroupContent BeginButtonGroup(ButtonSize size) 35 | { 36 | return ButtonGroup(size).BeginContent(); 37 | } 38 | 39 | #endregion 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/ButtonGroup/ButtonToolbarExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BootstrapMvc.Core; 3 | using BootstrapMvc.Buttons; 4 | 5 | namespace BootstrapMvc 6 | { 7 | public static class ButtonToolbarExtensions 8 | { 9 | #region Generation 10 | 11 | public static IItemWriter ButtonToolbar(this IAnyContentMarker contentHelper) 12 | { 13 | return contentHelper.CreateWriter(); 14 | } 15 | 16 | public static ButtonToolbarContent BeginButtonToolbar(this IAnyContentMarker contentHelper) 17 | { 18 | return ButtonToolbar(contentHelper).BeginContent(); 19 | } 20 | 21 | #endregion 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Buttons/ButtonSize.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public enum ButtonSize 6 | { 7 | Default, 8 | Large, 9 | Small, 10 | #if BOOTSTRAP3 11 | ExtraSmall 12 | #endif 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Buttons/ButtonType.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public enum ButtonType 6 | { 7 | #if BOOTSTRAP3 8 | DefaultGray, 9 | #endif 10 | #if BOOTSTRAP4 11 | SecondaryWhite, 12 | 13 | [Obsolete("Use SecondaryWhite instead")] 14 | DefaultGray = SecondaryWhite, 15 | #endif 16 | PrimaryBlue, 17 | InfoCyan, 18 | SuccessGreen, 19 | WarningOrange, 20 | DangerRed, 21 | Link, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Buttons/IButtonSizable.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Buttons 2 | { 3 | using System; 4 | 5 | public interface IButtonSizable 6 | { 7 | ButtonSize Size { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Buttons/IButtonSizableExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Buttons; 6 | 7 | public static class IButtonSizableExtensions 8 | { 9 | public static IItemWriter Size(this IItemWriter target, ButtonSize value) 10 | where T : IButtonSizable, IWritableItem 11 | { 12 | target.Item.Size = value; 13 | return target; 14 | } 15 | 16 | public static IItemWriter Size(this IItemWriter target, ButtonSize value) 17 | where T : ContentElement, IButtonSizable 18 | where TContent : DisposableContent 19 | { 20 | target.Item.Size = value; 21 | return target; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/CheckboxExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class CheckboxExtensions 8 | { 9 | public static IItemWriter Checkbox(this IAnyContentMarker contentHelper) 10 | { 11 | return contentHelper.CreateWriter(); 12 | } 13 | 14 | public static IItemWriter Checkbox(this IAnyContentMarker contentHelper, string text) 15 | { 16 | return contentHelper.CreateWriter().Text(text); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/EnumToStringConverter.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public static partial class EnumToStringConverter 6 | { 7 | public static string ToType(this InputType type) 8 | { 9 | switch (type) 10 | { 11 | case InputType.Text: 12 | return string.Empty; 13 | case InputType.DatetimeLocal: 14 | return "datetime-local"; 15 | default: 16 | return type.ToString().ToLowerInvariant(); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/IFormControl.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public interface IFormControl : IWritableItem, IDisableable 7 | { 8 | // Nothing more 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/IInlineDisplay.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | 5 | public interface IInlineDisplay 6 | { 7 | void SetInline(bool inline = true); 8 | 9 | bool IsInline(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/IInlineDisplayExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class IInlineDisplayExtensions 8 | { 9 | #region Fluent 10 | 11 | public static IItemWriter Inline(this IItemWriter target, bool inline = true) 12 | where T : IInlineDisplay, IWritableItem 13 | { 14 | target.Item.SetInline(inline); 15 | return target; 16 | } 17 | 18 | #endregion 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/ISelectItem.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public interface ISelectItem : IWritableItem 7 | { 8 | // Nothing 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/ITextDisplay.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | 5 | public interface ITextDisplay 6 | { 7 | string Text { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/ITextDisplayExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class ITextDisplayExtensions 8 | { 9 | public static IItemWriter Text(this IItemWriter target, string text) 10 | where T : ITextDisplay, IWritableItem 11 | { 12 | target.Item.Text = text; 13 | return target; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/IValueHolder.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | 5 | public interface IValueHolder 6 | { 7 | object Value { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/IValueHolderExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class IValueHolderExtensions 8 | { 9 | public static IItemWriter Value(this IItemWriter target, object value) 10 | where T : IValueHolder, IWritableItem 11 | { 12 | target.Item.Value = value; 13 | return target; 14 | } 15 | 16 | public static IItemWriter Value(this IItemWriter target, object value) 17 | where T : ContentElement, IValueHolder 18 | where TContent : DisposableContent 19 | { 20 | target.Item.Value = value; 21 | return target; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/InputType.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | 5 | public enum InputType 6 | { 7 | Text, 8 | Default = Text, 9 | Color, 10 | Date, 11 | [Obsolete("No more \"type=datetime\" in HTML 5.1, use DatetimeLocal")] 12 | Datetime, 13 | DatetimeLocal, 14 | Email, 15 | Month, 16 | Number, 17 | Password, 18 | Search, 19 | Tel, 20 | Time, 21 | Url, 22 | Week, 23 | File 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/RadioExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class RadioExtensions 8 | { 9 | public static IItemWriter Radio(this IAnyContentMarker contentHelper, object value, string text) 10 | { 11 | return contentHelper.CreateWriter().Text(text).Value(value.ToString()); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/SelectContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class SelectContent : SelectOptGroupContent 7 | { 8 | public SelectContent(IBootstrapContext context, IWritableItem parent) 9 | : base(context, parent) 10 | { 11 | // Nothing 12 | } 13 | 14 | public IItemWriter OptGroup(string label) 15 | { 16 | return Context.Helper.CreateWriter(Parent).Label(label); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/SelectOptGroup.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using System.Collections.Generic; 6 | 7 | public class SelectOptGroup : ContentElement, ISelectItem, IDisableable 8 | { 9 | public bool Disabled { get; set; } 10 | 11 | public string Label { get; set; } 12 | 13 | public IEnumerable ItemsValue { get; set; } 14 | 15 | protected override SelectOptGroupContent CreateContentContext(IBootstrapContext context) 16 | { 17 | return new SelectOptGroupContent(context, this); 18 | } 19 | 20 | protected override void WriteSelfStart(System.IO.TextWriter writer) 21 | { 22 | var tb = Helper.CreateTagBuilder("optgroup"); 23 | 24 | tb.MergeAttribute("label", Label, true); 25 | 26 | if (Disabled) 27 | { 28 | tb.MergeAttribute("disabled", "disabled", true); 29 | } 30 | 31 | ApplyCss(tb); 32 | ApplyAttributes(tb); 33 | 34 | tb.WriteStartTag(writer); 35 | 36 | if (ItemsValue != null) 37 | { 38 | foreach (var item in ItemsValue) 39 | { 40 | item.Parent = this; 41 | item.WriteTo(writer); 42 | } 43 | } 44 | } 45 | 46 | protected override void WriteSelfEnd(System.IO.TextWriter writer) 47 | { 48 | writer.Write(""); 49 | } 50 | 51 | void IDisableable.SetDisabled(bool disabled) 52 | { 53 | Disabled = disabled; 54 | } 55 | 56 | bool IDisableable.Disabled() 57 | { 58 | return Disabled; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/SelectOptGroupContent.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class SelectOptGroupContent : DisposableContent 7 | { 8 | public SelectOptGroupContent(IBootstrapContext context, IWritableItem parent) 9 | { 10 | this.Context = context; 11 | this.Parent = parent; 12 | } 13 | 14 | protected IBootstrapContext Context { get; set; } 15 | 16 | protected IWritableItem Parent { get; set; } 17 | 18 | public IItemWriter Option(object value) 19 | { 20 | return Option(value, value.ToString()); 21 | } 22 | 23 | public IItemWriter Option(object value, string text) 24 | { 25 | return Context.Helper.CreateWriter(Parent).Value(value.ToString()).Content(text); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/SelectOption.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Forms; 6 | 7 | public class SelectOption : AnyContentElement, ISelectItem, IDisableable, IValueHolder 8 | { 9 | public object Value { get; set; } 10 | 11 | public bool Disabled { get; set; } 12 | 13 | protected override string WriteSelfStartTag(System.IO.TextWriter writer) 14 | { 15 | var controlContext = GetNearestParent(); 16 | 17 | var tb = Helper.CreateTagBuilder("option"); 18 | 19 | if (Value != null) 20 | { 21 | tb.MergeAttribute("value", Value.ToString(), true); 22 | } 23 | if (Disabled) 24 | { 25 | tb.MergeAttribute("disabled", "disabled", true); 26 | } 27 | 28 | if (controlContext != null && controlContext.FieldValue != null && Value != null && Value.ToString().Equals(controlContext.FieldValue.ToString())) 29 | { 30 | tb.MergeAttribute("selected", "selected", true); 31 | } 32 | 33 | ApplyCss(tb); 34 | ApplyAttributes(tb); 35 | 36 | tb.WriteStartTag(writer); 37 | 38 | return tb.GetEndTag(); 39 | } 40 | 41 | void IDisableable.SetDisabled(bool disabled) 42 | { 43 | Disabled = disabled; 44 | } 45 | 46 | bool IDisableable.Disabled() 47 | { 48 | return Disabled; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/SelectOptionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Controls; 5 | using BootstrapMvc.Core; 6 | 7 | public static class SelectOptionExtensions 8 | { 9 | public static IItemWriter SelectOption(this IAnyContentMarker contentHelper, object value) 10 | { 11 | return SelectOption(contentHelper, value, value.ToString()); 12 | } 13 | 14 | public static IItemWriter SelectOption(this IAnyContentMarker contentHelper, object value, string text) 15 | { 16 | return contentHelper.CreateWriter().Value(value.ToString()).Content(text); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/StaticValue.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc.Controls 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | 6 | public class StaticValue : Element, IFormControl 7 | { 8 | public bool Disabled { get; set; } 9 | 10 | protected override void WriteSelf(System.IO.TextWriter writer) 11 | { 12 | var controlContext = GetNearestParent(); 13 | 14 | var input = Helper.CreateTagBuilder("p"); 15 | input.AddCssClass("form-control-static"); 16 | if (controlContext != null) 17 | { 18 | input.MergeAttribute("id", controlContext.FieldName, true); 19 | var value = controlContext.FieldValue; 20 | if (value != null) 21 | { 22 | input.InnerHtml = Helper.HtmlEncode(value.ToString()); 23 | } 24 | } 25 | if (Disabled) 26 | { 27 | // nothing - already read-only :) 28 | } 29 | 30 | ApplyCss(input); 31 | ApplyAttributes(input); 32 | 33 | input.WriteFullTag(writer); 34 | } 35 | 36 | void IDisableable.SetDisabled(bool disabled) 37 | { 38 | Disabled = disabled; 39 | } 40 | 41 | bool IDisableable.Disabled() 42 | { 43 | return Disabled; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/StaticValueExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class StaticValueExtensions 8 | { 9 | public static IItemWriter StaticValue(this IAnyContentMarker contentHelper) 10 | { 11 | return contentHelper.CreateWriter(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BootstrapMvc.BootstrapCommon/Components/Form_Controls/TextareaExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace BootstrapMvc 2 | { 3 | using System; 4 | using BootstrapMvc.Core; 5 | using BootstrapMvc.Controls; 6 | 7 | public static class TextareaExtensions 8 | { 9 | #region Fluent 10 | 11 | public static IItemWriter Rows(this IItemWriter target, int value) 12 | where T : Textarea 13 | { 14 | target.Item.Rows = value; 15 | return target; 16 | } 17 | 18 | #endregion 19 | 20 | #region Generating 21 | 22 | public static IItemWriter