PropCOptions { get; set; }
16 | public bool PropD { get; set; }
17 | public ChildModel Child { get; set; }
18 | }
19 |
20 | public class ChildModel
21 | {
22 | [Display(Name = "Child Property A")]
23 | public string ChildPropA { get; set; }
24 | }
25 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FluentBootstrap.Tests.Web")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Dave Glick")]
12 | [assembly: AssemblyProduct("FluentBootstrap.Tests.Web")]
13 | [assembly: AssemblyCopyright("Copyright © Dave Glick 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("cfb975f2-23e0-4383-82db-e62b932836a1")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | FluentBootstrap Tests
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | @RenderBody()
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Alerts.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("States")
4 | using (Html.Bootstrap().Div().SetId("test-states").Begin())
5 | {
6 | @Html.Bootstrap().Alert(AlertState.Success, "Success")
7 | @Html.Bootstrap().Alert(AlertState.Info, "Info")
8 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning")
9 | @Html.Bootstrap().Alert(AlertState.Danger, "Danger")
10 | }
11 |
12 |
13 |
14 | @Html.Bootstrap().Heading1("Heading")
15 | using (Html.Bootstrap().Div().SetId("test-heading").Begin())
16 | {
17 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning", "Yikes, this is a warning.")
18 | }
19 |
20 |
21 |
22 | @Html.Bootstrap().Heading1("Dismissible")
23 | using (Html.Bootstrap().Div().SetId("test-dismissible").Begin())
24 | {
25 | @Html.Bootstrap().Alert(AlertState.Warning, "Yikes, this is a warning.").SetDismissible()
26 | }
27 |
28 |
29 |
30 | @Html.Bootstrap().Heading1("Dismissible With Heading")
31 | using (Html.Bootstrap().Div().SetId("test-dismissible-with-heading").Begin())
32 | {
33 | @Html.Bootstrap().Alert(AlertState.Warning, "Warning", "Yikes, this is a warning.").SetDismissible()
34 | }
35 |
36 |
37 |
38 | @Html.Bootstrap().Heading1("Links")
39 | using (Html.Bootstrap().Div().SetId("test-links").Begin())
40 | {
41 | using(Html.Bootstrap().Alert(AlertState.Warning).SetHeading("Yikes!").Begin())
42 | {
43 | This is @Html.Bootstrap().Link("link") inside the alert.
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Architecture.cshtml:
--------------------------------------------------------------------------------
1 | @using FluentBootstrap;
2 |
3 | @using (Html.Bootstrap().Container().Begin())
4 | {
5 | @Html.Bootstrap().Heading1("Alternate Model")
6 | using (Html.Bootstrap().Div().SetId("test-alternate-model").Begin())
7 | {
8 | var model = new { Foo = "Foo", Bar = true, Baz = 123 };
9 | using(var form = Html.Bootstrap(model).Form().Begin())
10 | {
11 | @form.EditorFor(x => x.Foo)
12 | @form.DisplayFor(x => x.Bar)
13 | @form.EditorFor(x => x.Baz)
14 | }
15 | }
16 |
17 |
18 |
19 | @Html.Bootstrap().Heading1("Alternate Begin Syntax")
20 | using (Html.Bootstrap().Div().SetId("test-alternate-begin").Begin())
21 | {
22 | using (var group = Html.Bootstrap().Begin(x => x.ButtonGroup()))
23 | {
24 | @group.Button("A").SetIcon(Icon.Music)
25 | @group.Button("B")
26 | }
27 | }
28 | }
29 |
30 | @Html.Bootstrap().Heading1("Empty Stack (Issue #1)")
31 | @Html.Bootstrap().Dropdown("My Dropdown")
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Badges.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("Inline")
4 | using (Html.Bootstrap().Div().SetId("test-inline").Begin())
5 | {
6 | Badge @Html.Bootstrap().Badge("4")
7 | }
8 |
9 |
10 |
11 | @Html.Bootstrap().Heading1("Link")
12 | using (Html.Bootstrap().Div().SetId("test-link").Begin())
13 | {
14 | @Html.Bootstrap().Link("Link").WithChild().Badge("789")
15 | }
16 |
17 |
18 |
19 | @Html.Bootstrap().Heading1("Button")
20 | using (Html.Bootstrap().Div().SetId("test-button").Begin())
21 | {
22 | @Html.Bootstrap().Button("Button").WithChild().Badge("4")
23 | @Html.Bootstrap().Button("Button").SetState(ButtonState.Primary).WithChild().Badge("456")
24 | }
25 |
26 |
27 |
28 | @Html.Bootstrap().Heading1("Pills")
29 | using (Html.Bootstrap().Div().SetId("test-pills").Begin())
30 | {
31 | using(var pills = Html.Bootstrap().Pills().Begin())
32 | {
33 | @pills.Pill("A").WithChild().Badge("3")
34 | @pills.Pill("B").SetActive().WithChild().Badge("5")
35 | }
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Breadcrumbs.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("Breadcrumb")
4 | using (Html.Bootstrap().Div().SetId("test-breadcrumb").Begin())
5 | {
6 | using(var breadcrumb = Html.Bootstrap().Breadcrumb().Begin())
7 | {
8 | @breadcrumb.Crumb("First")
9 | @breadcrumb.Crumb("Second")
10 | @breadcrumb.Crumb("Third").SetActive()
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Icons.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("Inline Icon")
4 | using (Html.Bootstrap().Div().SetId("test-inline-icon").Begin())
5 | {
6 | This is an inline @Html.Bootstrap().Icon(Icon.ArrowUp) icon.
7 | }
8 |
9 |
10 |
11 | @Html.Bootstrap().Heading1("Button Icon")
12 | using (Html.Bootstrap().Div().SetId("test-button-icon").Begin())
13 | {
14 | @Html.Bootstrap().Button("Icon Button").SetIcon(Icon.Bell)
15 | }
16 |
17 |
18 |
19 | @Html.Bootstrap().Heading1("Link Button Icon")
20 | using (Html.Bootstrap().Div().SetId("test-link-button-icon").Begin())
21 | {
22 | @Html.Bootstrap().LinkButton("Link Button").SetIcon(Icon.Picture)
23 | }
24 |
25 |
26 |
27 | @Html.Bootstrap().Heading1("Link Icon")
28 | using (Html.Bootstrap().Div().SetId("test-link-icon").Begin())
29 | {
30 | @Html.Bootstrap().Link("Link").SetIcon(Icon.Road)
31 | }
32 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Images.cshtml:
--------------------------------------------------------------------------------
1 | @using FluentBootstrap;
2 |
3 | @using (Html.Bootstrap().Container().Begin())
4 | {
5 | @Html.Bootstrap().Heading1("Images")
6 | using (Html.Bootstrap().Div().SetId("test-images").Begin())
7 | {
8 | @Html.Bootstrap().Image("http://placehold.it/64x64")
9 | @Html.Bootstrap().Image("http://placehold.it/64x64", "With Alt")
10 | }
11 |
12 |
13 |
14 | @Html.Bootstrap().Heading1("Image Links")
15 | using (Html.Bootstrap().Div().SetId("test-image-links").Begin())
16 | {
17 | @Html.Bootstrap().Image("http://placehold.it/64x64", "Alt").SetHref("http://www.google.com")
18 | }
19 |
20 |
21 |
22 | @Html.Bootstrap().Heading1("Placeholder")
23 | using (Html.Bootstrap().Div().SetId("test-placeholder").Begin())
24 | {
25 | @Html.Bootstrap().Placeholder(200, 40).SetText("Placeholder!").SetColors("#800000", "CC0000").SetHref("http://www.google.com").SetAlt("This is my placeholder")
26 | }
27 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Labels.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("Inline")
4 | using (Html.Bootstrap().Div().SetId("test-inline").Begin())
5 | {
6 | This is a @Html.Bootstrap().Label("inline") label.
7 | }
8 |
9 |
10 |
11 | @Html.Bootstrap().Heading1("Headers")
12 | using (Html.Bootstrap().Div().SetId("test-headers").Begin())
13 | {
14 | @Html.Bootstrap().Heading1("A label in a ").WithChild().Label("heading")
15 | using(var heading = Html.Bootstrap().Heading3(null).Begin())
16 | {
17 | Another heading with a @Html.Bootstrap().Label("label").SetState(LabelState.Danger)
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Links.cshtml:
--------------------------------------------------------------------------------
1 | @using FluentBootstrap;
2 |
3 | @using (Html.Bootstrap().Container().Begin())
4 | {
5 | @Html.Bootstrap().Heading1("No Pretty Printing")
6 | using (Html.Bootstrap().Div().SetId("test-no-pretty-printing").Begin())
7 | {
8 | @Html.Bootstrap().Link("Link 1")|@Html.Bootstrap().Link("Link 2")
9 | }
10 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Misc.cshtml:
--------------------------------------------------------------------------------
1 | @Html.Bootstrap().Heading1("Full Width Jumbotron")
2 | @using (Html.Bootstrap().Div().SetId("test-fullwidth-jumbotron").Begin())
3 | {
4 | using (Html.Bootstrap().Jumbotron().Begin())
5 | {
6 | using (Html.Bootstrap().Container().Begin())
7 | {
8 | @Html.Bootstrap().Heading1("Heading")
9 | @Html.Bootstrap().Paragraph("Some text.")
10 | }
11 | }
12 | }
13 |
14 |
15 |
16 | @using (Html.Bootstrap().Container().Begin())
17 | {
18 | @Html.Bootstrap().Heading1("Jumbotron")
19 | using (Html.Bootstrap().Div().SetId("test-jumbotron").Begin())
20 | {
21 | using(Html.Bootstrap().Jumbotron().Begin())
22 | {
23 | @Html.Bootstrap().Heading1("Heading")
24 | @Html.Bootstrap().Paragraph("Some text.")
25 | }
26 | }
27 |
28 |
29 |
30 | @Html.Bootstrap().Heading1("Simple Page Header")
31 | using (Html.Bootstrap().Div().SetId("test-simple-pageheader").Begin())
32 | {
33 | @Html.Bootstrap().PageHeader("Header").SetSmallText("Small Text")
34 | }
35 |
36 |
37 |
38 | @Html.Bootstrap().Heading1("Complex Page Header")
39 | using (Html.Bootstrap().Div().SetId("test-complex-pageheader").Begin())
40 | {
41 | using (var pageHeader = Html.Bootstrap().PageHeader().Begin())
42 | {
43 | Header
44 | @pageHeader.Small("Some small text")
45 | @pageHeader.Label("A label")
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Pagers.cshtml:
--------------------------------------------------------------------------------
1 | @using FluentBootstrap;
2 |
3 | @using (Html.Bootstrap().Container().Begin())
4 | {
5 | @Html.Bootstrap().Heading1("Manual")
6 | using (Html.Bootstrap().Div().SetId("test-manual").Begin())
7 | {
8 | using (var pager = Html.Bootstrap().Pager().Begin())
9 | {
10 | @pager.Page("Older", "http://google.com")
11 | @pager.Page("Archive").SetDisabled()
12 | @pager.Page("Newer")
13 | }
14 | }
15 |
16 |
17 |
18 | @Html.Bootstrap().Heading1("Automatic")
19 | using (Html.Bootstrap().Div().SetId("test-automatic").Begin())
20 | {
21 | @Html.Bootstrap().Pager().AddPrevious("Oldest").AddPrevious("Old", disabled: true).AddPage("Archive").AddNext("Newer")
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Tables.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("Striped")
4 | using (Html.Bootstrap().Div().SetId("test-striped").Begin())
5 | {
6 | using (var table = Html.Bootstrap(this).Table().SetStyle(TableStyle.Striped).Begin())
7 | {
8 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username")
9 | @table.TableDataRow("1", "Mark", "Otto", "mdo")
10 | @table.TableDataRow("2", "Jacob", "Thornton", "fat")
11 | }
12 | }
13 |
14 |
15 |
16 | @Html.Bootstrap().Heading1("Explicit Sections")
17 | using (Html.Bootstrap().Div().SetId("test-explicit-sections").Begin())
18 | {
19 | using (var table = Html.Bootstrap(this).Table().Begin())
20 | {
21 | using (table.TableHeadSection().Begin())
22 | {
23 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username")
24 | @table.TableDataRow("1", "Mark", "Otto", "mdo")
25 | }
26 | using (table.TableBodySection().Begin())
27 | {
28 | @table.TableHeaderRow("#", "First Name", "Last Name", "Username")
29 | @table.TableDataRow("2", "Jacob", "Thornton", "fat")
30 | }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/Tests/Tags.cshtml:
--------------------------------------------------------------------------------
1 | @using (Html.Bootstrap().Container().Begin())
2 | {
3 | @Html.Bootstrap().Heading1("With Child")
4 | using (Html.Bootstrap().Div().SetId("test-with-child").Begin())
5 | {
6 | @Html.Bootstrap().GridRow().WithChild().GridColumn(12).AddContent("With Child")
7 | }
8 |
9 |
10 |
11 | @Html.Bootstrap().Heading1("With Child Disposable")
12 | using (Html.Bootstrap().Div().SetId("test-with-child-disposable").Begin())
13 | {
14 | using (Html.Bootstrap().GridRow().WithChild().GridColumn(12).Begin())
15 | {
16 | With Child Disposable
17 | }
18 | }
19 |
20 |
21 |
22 | @Html.Bootstrap().Heading1("With Child Nested")
23 | using (Html.Bootstrap().Div().SetId("test-with-child-nested").Begin())
24 | {
25 | using (var row = Html.Bootstrap().Container().WithChild().GridRow().Begin())
26 | {
27 | using (row.GridColumn(8).Begin())
28 | {
29 | A
30 | }
31 | @row.GridColumn(4).AddContent("B")
32 | }
33 | }
34 |
35 |
36 |
37 | @Html.Bootstrap().Heading1("Add Child")
38 | using (Html.Bootstrap().Div().SetId("test-add-child").Begin())
39 | {
40 | @Html.Bootstrap().GridRow().AddChild(x => x.GridColumn(6).AddContent("A")).AddChild(x => x.GridColumn(6).AddContent("B").AddChild(y => Html.Bootstrap().Container()))
41 | }
42 |
43 |
44 |
45 | @Html.Bootstrap().Heading1("AddContent adds a component")
46 | using (Html.Bootstrap().Div().SetId("test-addcontent-adds-component").Begin())
47 | {
48 | @Html.Bootstrap().Div().AddContent(Html.Bootstrap().Span("span-component"))
49 | }
50 |
51 |
52 |
53 | @Html.Bootstrap().Heading1("AddContentAtEnd adds a component")
54 | using (Html.Bootstrap().Div().SetId("test-addcontentatend-adds-component").Begin())
55 | {
56 | @Html.Bootstrap().Div().AddContentAtEnd(Html.Bootstrap().Span("span-component1")).AddContentAtEnd(Html.Bootstrap().Span("span-component2"))
57 | }
58 | }
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @using FluentBootstrap;
2 |
3 | @{
4 | Layout = "~/Views/Shared/_Layout.cshtml";
5 | }
6 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Views/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daveaglick/FluentBootstrap/03d16f5897afa4be25f1ba1edc6835ae347242d6/FluentBootstrap.Tests.Web/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/FluentBootstrap.Tests.Web/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/ArchitectureFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class ArchitectureFixture
12 | {
13 | // Note that the editor/display templates can't be tested properly here because RazorGenerator doesn't support partials
14 | [Test]
15 | public void AlternateModelProducesCorrectHtml()
16 | {
17 | TestHelper.AssertHtml("test-alternate-model",
18 | @"");
38 | }
39 |
40 | [Test]
41 | public void AlternateBeginSyntaxProducesCorrectHtml()
42 | {
43 | TestHelper.AssertHtml("test-alternate-begin",
44 | @"
45 |
48 |
49 |
");
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/BadgesFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class BadgesFixture
12 | {
13 | [Test]
14 | public void InlineBadgeProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-inline",
17 | @"Badge
18 | 4
");
19 | }
20 |
21 | [Test]
22 | public void LinkBadgeProducesCorrectHtml()
23 | {
24 | TestHelper.AssertHtml("test-link",
25 | @"Link
26 | 789
");
27 | }
28 |
29 | [Test]
30 | public void ButtonBadgeProducesCorrectHtml()
31 | {
32 | TestHelper.AssertHtml("test-button",
33 | @"
36 | ");
39 | }
40 |
41 | [Test]
42 | public void PillsBadgeProducesCorrectHtml()
43 | {
44 | TestHelper.AssertHtml("test-pills",
45 | @"");
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/BreadcrumbsFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class BreadcrumbsFixture
12 | {
13 | [Test]
14 | public void BreadcrumbProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-breadcrumb",
17 | @"
18 | -
19 | First
20 |
21 | -
22 | Second
23 |
24 | - Third
25 |
");
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/IconsFixture.cs:
--------------------------------------------------------------------------------
1 | using HtmlAgilityPack;
2 | using NUnit.Framework;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace FluentBootstrap.Tests
10 | {
11 | [TestFixture]
12 | public class IconsFixture
13 | {
14 | [Test]
15 | public void InlineIconProducesCorrectHtml()
16 | {
17 | TestHelper.AssertHtml("test-inline-icon",
18 | @"This is an inline
19 | icon.");
20 | }
21 |
22 | [Test]
23 | public void ButtonIconProducesCorrectHtml()
24 | {
25 | TestHelper.AssertHtml("test-button-icon",
26 | @"");
29 | }
30 |
31 | [Test]
32 | public void LinkButtonIconProducesCorrectHtml()
33 | {
34 | TestHelper.AssertHtml("test-link-button-icon",
35 | @"
36 | Link Button
37 | ");
38 | }
39 |
40 | [Test]
41 | public void LinkIconProducesCorrectHtml()
42 | {
43 | TestHelper.AssertHtml("test-link-icon",
44 | @"
45 | Link");
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/ImagesFixture.cs:
--------------------------------------------------------------------------------
1 | using HtmlAgilityPack;
2 | using NUnit.Framework;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace FluentBootstrap.Tests
10 | {
11 | [TestFixture]
12 | public class ImagesFixture
13 | {
14 | [Test]
15 | public void ImagesProduceCorrectHtml()
16 | {
17 | TestHelper.AssertHtml("test-images",
18 | @"
19 |
");
20 | }
21 |
22 | [Test]
23 | public void ImageLinksProduceCorrectHtml()
24 | {
25 | TestHelper.AssertHtml("test-image-links",
26 | @"
");
27 | }
28 |
29 | [Test]
30 | public void PlaceholderProducesCorrectHtml()
31 | {
32 | TestHelper.AssertHtml("test-placeholder",
33 | @"
");
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/LabelsFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class LabelsFixture
12 | {
13 | [Test]
14 | public void ManualPagerProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-inline",
17 | @"This is a
18 | inline label.
");
19 | }
20 |
21 | [Test]
22 | public void AutomaticPagerProducesCorrectHtml()
23 | {
24 | TestHelper.AssertHtml("test-headers",
25 | @"A label in a
26 | heading
27 |
28 | Another heading with a
29 | label
30 |
31 |
");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/LinksFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class LinksFixture
12 | {
13 | // Note that the editor/display templates can't be tested properly here because RazorGenerator doesn't support partials
14 | [Test]
15 | public void AlternateModelProducesCorrectHtml()
16 | {
17 | TestHelper.AssertHtml("test-no-pretty-printing",
18 | @"Link 1|Link 2");
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/MiscFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class MiscFixture
12 | {
13 | [Test]
14 | public void FullWidthJumbotronProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-fullwidth-jumbotron",
17 | @"
18 |
19 |
Heading
20 |
Some text.
21 |
22 |
");
23 | }
24 |
25 | [Test]
26 | public void JumbotronProducesCorrectHtml()
27 | {
28 | TestHelper.AssertHtml("test-jumbotron",
29 | @"
30 |
Heading
31 |
Some text.
32 |
");
33 | }
34 |
35 | [Test]
36 | public void SimplePageHeaderProducesCorrectHtml()
37 | {
38 | TestHelper.AssertHtml("test-simple-pageheader",
39 | @"
40 |
Header
41 | Small Text
42 |
43 | ");
44 | }
45 |
46 | [Test]
47 | public void ComplexPageHeaderProducesCorrectHtml()
48 | {
49 | TestHelper.AssertHtml("test-complex-pageheader",
50 | @"
51 |
Header
52 |
53 | Some small text
54 | A label
55 |
56 | ");
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/PagersFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class PagersFixture
12 | {
13 | [Test]
14 | public void ManualPagerProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-manual",
17 | @"");
30 | }
31 |
32 | [Test]
33 | public void AutomaticPagerProducesCorrectHtml()
34 | {
35 | TestHelper.AssertHtml("test-automatic",
36 | @"");
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FluentBootstrap.Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Dave Glick")]
12 | [assembly: AssemblyProduct("FluentBootstrap.Tests")]
13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("f1f9186a-ec3f-42f2-9a02-db83cf203fad")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/SimpleBootstrapHelperFixture.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using NUnit.Framework;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class SimpleBootstrapHelperFixture
12 | {
13 | [Test]
14 | public void SimpleBootstrapHelperProducesCorrectHtmlForInput()
15 | {
16 | // Given
17 | SimpleBootstrapHelper helper = new SimpleBootstrapHelper();
18 |
19 | // When
20 | string input = helper.Input("input-name", "My Input").ToString().Replace("\r\n", "\n");
21 |
22 | // Then
23 | Assert.AreEqual(@"
24 |
25 | ".Replace("\r\n", "\n"), input);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/TablesFixture.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Tests
9 | {
10 | [TestFixture]
11 | public class TablesFixture
12 | {
13 | [Test]
14 | public void StripedTableProducesCorrectHtml()
15 | {
16 | TestHelper.AssertHtml("test-striped",
17 | @"
18 |
19 |
20 | # |
21 | First Name |
22 | Last Name |
23 | Username |
24 |
25 |
26 |
27 |
28 | 1 |
29 | Mark |
30 | Otto |
31 | mdo |
32 |
33 |
34 | 2 |
35 | Jacob |
36 | Thornton |
37 | fat |
38 |
39 |
40 |
");
41 | }
42 |
43 | [Test]
44 | public void TableWithExplicitSectionsProducesCorrectHtml()
45 | {
46 | TestHelper.AssertHtml("test-explicit-sections",
47 | @"
48 |
49 |
50 | # |
51 | First Name |
52 | Last Name |
53 | Username |
54 |
55 |
56 | 1 |
57 | Mark |
58 | Otto |
59 | mdo |
60 |
61 |
62 |
63 |
64 | # |
65 | First Name |
66 | Last Name |
67 | Username |
68 |
69 |
70 | 2 |
71 | Jacob |
72 | Thornton |
73 | fat |
74 |
75 |
76 |
");
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/FluentBootstrap.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FluentBootstrap.WebPages/FluentBootstrap.WebPages.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | FluentBootstrap.WebPages
5 | $version$
6 | FluentBootstrap.WebPages
7 | Dave Glick
8 | Dave Glick
9 | https://github.com/somedave/FluentBootstrap/blob/master/license.txt
10 | http://fluentbootstrap.com/Content/fb-icon.png
11 | http://fluentbootstrap.com
12 | false
13 | Provides HtmlHelpers for the Bootstrap CSS framework in ASP.NET Web Pages.
14 | Copyright 2015
15 | Bootstrap AspNet WebPages AspNetWebPages
16 |
17 |
--------------------------------------------------------------------------------
/FluentBootstrap.WebPages/HtmlHelperExtensions.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.WebPages;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Web.WebPages;
8 | using System.Web.WebPages.Html;
9 |
10 | namespace FluentBootstrap
11 | {
12 | public static class HtmlHelperExtensions
13 | {
14 | public static WebPagesBootstrapHelper Bootstrap(this HtmlHelper htmlHelper, WebPageBase webPageBase)
15 | {
16 | return new WebPagesBootstrapHelper(webPageBase);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FluentBootstrap.WebPages/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("FluentBootstrap.WebPages")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Dave Glick")]
12 | [assembly: AssemblyProduct("FluentBootstrap.WebPages")]
13 | [assembly: AssemblyCopyright("Copyright © Dave Glick")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0eaf1cd1-b8d5-4813-b510-d285dd42f76b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("3.3.5.4")]
36 | [assembly: AssemblyFileVersion("3.3.5.4")]
37 | [assembly: AssemblyInformationalVersion("3.3.5.4")]
38 |
--------------------------------------------------------------------------------
/FluentBootstrap.WebPages/WebPagesBootstrapConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Web.WebPages;
8 |
9 | namespace FluentBootstrap.WebPages
10 | {
11 | public class WebPagesBootstrapConfig : BootstrapConfig
12 | {
13 | internal WebPageBase WebPageBase { get; private set; }
14 |
15 | public WebPagesBootstrapConfig(WebPageBase webPageBase)
16 | {
17 | WebPageBase = webPageBase;
18 | }
19 |
20 | protected override TextWriter GetWriter()
21 | {
22 | return WebPageBase.Output;
23 | }
24 |
25 | protected override object GetItem(object key, object defaultValue)
26 | {
27 | if (WebPageBase.Context.Items.Contains(key))
28 | {
29 | return WebPageBase.Context.Items[key];
30 | }
31 | return defaultValue;
32 | }
33 |
34 | protected override void AddItem(object key, object value)
35 | {
36 | WebPageBase.Context.Items[key] = value;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/FluentBootstrap.WebPages/WebPagesBootstrapHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Web;
8 | using System.Web.WebPages;
9 |
10 | namespace FluentBootstrap.WebPages
11 | {
12 | public class WebPagesBootstrapHelper : BootstrapHelper
13 | {
14 | public WebPagesBootstrapHelper(WebPageBase webPageBase)
15 | : base(new WebPagesBootstrapConfig(webPageBase))
16 | {
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FluentBootstrap.jmconfig:
--------------------------------------------------------------------------------
1 | false
--------------------------------------------------------------------------------
/FluentBootstrap/Alerts/Alert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Alerts
9 | {
10 | public class Alert : Tag, IHasTextContent
11 | {
12 | public bool Dismissible { set; get; }
13 | public string Heading { set; get; }
14 |
15 | internal Alert(BootstrapHelper helper)
16 | : base(helper, "div", Css.Alert, Css.AlertInfo)
17 | {
18 | MergeAttribute("role", "alert");
19 | }
20 |
21 | protected override void OnStart(TextWriter writer)
22 | {
23 | if (Dismissible)
24 | {
25 | AddCss(Css.AlertDismissible);
26 | }
27 |
28 | base.OnStart(writer);
29 |
30 | if (Dismissible)
31 | {
32 | GetHelper().Element("button").AddAttribute("type", "button").AddCss(Css.Close).AddAttribute("data-dismiss", "alert")
33 | .AddChild(_ => GetHelper().Span().AddAttribute("aria-hidden", "true").SetText("\u00D7"))
34 | .AddChild(_ => GetHelper().Span().AddCss(Css.SrOnly).SetText("Close"))
35 | .Component.StartAndFinish(writer);
36 | }
37 |
38 | if (!string.IsNullOrWhiteSpace(Heading))
39 | {
40 | GetHelper().Strong(Heading + " ").Component.StartAndFinish(writer);
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/FluentBootstrap/Alerts/AlertState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap
9 | {
10 | public enum AlertState
11 | {
12 | [Description(Css.AlertSuccess)]
13 | Success,
14 | [Description(Css.AlertInfo)]
15 | Info,
16 | [Description(Css.AlertWarning)]
17 | Warning,
18 | [Description(Css.AlertDanger)]
19 | Danger
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/FluentBootstrap/BackgroundState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap
9 | {
10 | public enum BackgroundState
11 | {
12 | [Description(Css.BgPrimary)]
13 | Primary,
14 | [Description(Css.BgSuccess)]
15 | Success,
16 | [Description(Css.BgInfo)]
17 | Info,
18 | [Description(Css.BgWarning)]
19 | Warning,
20 | [Description(Css.BgDanger)]
21 | Danger
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/FluentBootstrap/Badges/Badge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentBootstrap.Badges
8 | {
9 | public class Badge : Tag, IHasTextContent
10 | {
11 | internal Badge(BootstrapHelper helper)
12 | : base(helper, "span", Css.Badge)
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/FluentBootstrap/Badges/BadgeExtensions.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.Badges;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap
9 | {
10 | public static class BadgeExtensions
11 | {
12 | public static ComponentBuilder Badge(this BootstrapHelper helper, object text)
13 | where TConfig : BootstrapConfig
14 | where TComponent : Component, ICanCreate
15 | {
16 | return new ComponentBuilder(helper.Config, new Badge(helper)).SetText(text);
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/FluentBootstrap/BootstrapHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Collections.Generic;
4 | using System.Globalization;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace FluentBootstrap
11 | {
12 | public abstract class BootstrapHelper
13 | {
14 | internal abstract BootstrapConfig GetConfig();
15 |
16 | internal virtual Component GetParent()
17 | {
18 | return null;
19 | }
20 | }
21 |
22 | public abstract class BootstrapHelper : BootstrapHelper
23 | where TConfig : BootstrapConfig
24 | where TComponent : Component
25 | {
26 | private readonly TConfig _config;
27 |
28 | protected BootstrapHelper(TConfig config)
29 | {
30 | _config = config;
31 | }
32 |
33 | internal TConfig Config
34 | {
35 | get { return _config; }
36 | }
37 |
38 | internal override BootstrapConfig GetConfig()
39 | {
40 | return Config;
41 | }
42 |
43 | // This allows an alternate syntax by using a func inside the Begin method
44 | public ComponentWrapper Begin(Func, ComponentBuilder> component)
45 | where TNewComponent : Component
46 | {
47 | return component(this).Begin();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/FluentBootstrap/Breadcrumbs/Breadcrumb.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace FluentBootstrap.Breadcrumbs
8 | {
9 | public class Breadcrumb : Tag,
10 | ICanCreate
11 | {
12 | internal Breadcrumb(BootstrapHelper helper)
13 | : base(helper, "ol", Css.Breadcrumb)
14 | {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/FluentBootstrap/Breadcrumbs/BreadcrumbExtensions.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.Breadcrumbs;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap
9 | {
10 | public static class BreadcrumbExtensions
11 | {
12 | public static ComponentBuilder Breadcrumb(this BootstrapHelper helper)
13 | where TConfig : BootstrapConfig
14 | where TComponent : Component, ICanCreate
15 | {
16 | return new ComponentBuilder(helper.Config, new Breadcrumb(helper));
17 | }
18 |
19 | public static ComponentBuilder Crumb(this BootstrapHelper helper, object text, string href = "#")
20 | where TConfig : BootstrapConfig
21 | where TComponent : Component, ICanCreate
22 | {
23 | return new ComponentBuilder(helper.Config, new Crumb(helper))
24 | .SetHref(href).SetText(text);
25 | }
26 |
27 | public static ComponentBuilder SetActive(this ComponentBuilder builder, bool active = true)
28 | where TConfig : BootstrapConfig
29 | {
30 | builder.Component.Active = active;
31 | return builder;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/FluentBootstrap/Breadcrumbs/Crumb.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.Html;
2 | using FluentBootstrap.Links;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace FluentBootstrap.Breadcrumbs
11 | {
12 | public class Crumb : Tag, IHasLinkExtensions, IHasTextContent
13 | {
14 | private Element _listItem = null;
15 |
16 | public bool Active { get; set; }
17 |
18 | internal Crumb(BootstrapHelper helper)
19 | : base(helper, "a")
20 | {
21 | }
22 |
23 | protected override void OnStart(TextWriter writer)
24 | {
25 | // Create the list item wrapper
26 | _listItem = this.GetHelper().Element("li").Component;
27 | if (Active)
28 | {
29 | _listItem.AddCss(Css.Active);
30 | }
31 | _listItem.Start(writer);
32 |
33 | base.OnStart(Active ? new SuppressOutputWriter() : writer);
34 | }
35 |
36 | protected override void OnFinish(TextWriter writer)
37 | {
38 | base.OnFinish(Active ? new SuppressOutputWriter() : writer);
39 |
40 | _listItem.Finish(writer);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/FluentBootstrap/Buttons/Button.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.Badges;
2 | using FluentBootstrap.Icons;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace FluentBootstrap.Buttons
11 | {
12 | public class Button : Tag,
13 | IHasIconExtensions, IHasButtonExtensions, IHasButtonStateExtensions,
14 | IHasDisabledAttribute, IHasTextContent, IHasValueAttribute,
15 | ICanCreate
16 | {
17 | private ButtonGroup _buttonGroup;
18 |
19 | internal Button(BootstrapHelper helper, ButtonType buttonType)
20 | : base(helper, "button", Css.Btn, Css.BtnDefault)
21 | {
22 | MergeAttribute("type", buttonType.GetDescription());
23 | }
24 |
25 | protected override void OnStart(TextWriter writer)
26 | {
27 | // Fix for justified buttons in a group (need to surround them with an extra button group)
28 | // See https://github.com/twbs/bootstrap/issues/12476
29 | ButtonGroup buttonGroup = GetComponent(true);
30 | if (buttonGroup != null && buttonGroup.CssClasses.Contains(Css.BtnGroupJustified))
31 | {
32 | _buttonGroup = GetHelper().ButtonGroup().Component;
33 | _buttonGroup.Start(writer);
34 | }
35 |
36 | base.OnStart(writer);
37 | }
38 |
39 | protected override void OnFinish(TextWriter writer)
40 | {
41 | base.OnFinish(writer);
42 |
43 | if (_buttonGroup != null)
44 | {
45 | _buttonGroup.Finish(writer);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/FluentBootstrap/Buttons/ButtonGroup.cs:
--------------------------------------------------------------------------------
1 | using FluentBootstrap.Dropdowns;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace FluentBootstrap.Buttons
9 | {
10 | public class ButtonGroup : Tag,
11 | ICanCreate