Browse Source

Enum refactoring grid tag helpers

pull/272/head
yekalkan 8 years ago
parent
commit
ec3e5bf21f
  1. 14
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs
  2. 26
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/ColumnOrder.cs
  3. 29
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/ColumnSize.cs
  4. 23
      test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Forms.cshtml
  5. 12
      test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Forms.cshtml.cs
  6. 42
      test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Grids.cshtml
  7. 1
      test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Index.cshtml

14
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs

@ -30,14 +30,18 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
protected virtual void ProcessSizeClass(TagHelperOutput output, ColumnSize size, string breakpoint)
{
if (size == ColumnSize.Empty)
if (size == ColumnSize.Undefined)
{
return;
}
var classString = "col" + breakpoint;
if (size != ColumnSize.C)
if (size == ColumnSize.Auto)
{
classString += "-auto";
}
else if (size != ColumnSize._)
{
classString += "-" + size.ToString("D");
}
@ -47,14 +51,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
protected virtual void ProcessOffsetClass(TagHelperOutput output, ColumnSize size, string breakpoint)
{
if (size == ColumnSize.Empty)
if (size == ColumnSize.Undefined)
{
return;
}
var classString = "offset" + breakpoint;
if (size == ColumnSize.C)
if (size == ColumnSize._)
{
classString += "-0";
}
@ -78,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid
protected virtual void ProcessColumnOrder(TagHelperOutput output)
{
if (TagHelper.ColumnOrder == ColumnOrder.Empty)
if (TagHelper.ColumnOrder == ColumnOrder.Undefined)
{
return;
}

26
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/ColumnOrder.cs

@ -2,19 +2,19 @@
{
public enum ColumnOrder
{
Empty = 0,
C1 = 1,
C2 = 2,
C3 = 3,
C4 = 4,
C5 = 5,
C6 = 6,
C7 = 7,
C8 = 8,
C9 = 9,
C10 = 10,
C11 = 11,
C12 = 12,
Undefined = 0,
_1 = 1,
_2 = 2,
_3 = 3,
_4 = 4,
_5 = 5,
_6 = 6,
_7 = 7,
_8 = 8,
_9 = 9,
_10 = 10,
_11 = 11,
_12 = 12,
First = 13,
Last = 14
}

29
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/ColumnSize.cs

@ -2,19 +2,20 @@
{
public enum ColumnSize
{
Empty = 0,
C1 = 1,
C2 = 2,
C3 = 3,
C4 = 4,
C5 = 5,
C6 = 6,
C7 = 7,
C8 = 8,
C9 = 9,
C10 = 10,
C11 = 11,
C12 = 12,
C = -1
Undefined = 0,
_1 = 1,
_2 = 2,
_3 = 3,
_4 = 4,
_5 = 5,
_6 = 6,
_7 = 7,
_8 = 8,
_9 = 9,
_10 = 10,
_11 = 11,
_12 = 12,
Auto = 13,
_ = -1
}
}

23
test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Forms.cshtml

@ -0,0 +1,23 @@
@page
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.FormsModel
@{
ViewData["Title"] = "Forms";
}
<h2>Forms</h2>
<p>Based on <a href="http://getbootstrap.com/docs/4.1/components/forms/" target="_blank"> Bootstrap form</a>.</p>
<h4># Example</h4>
<div class="demo-with-code">
<div class="demo-area">
</div>
<div class="code-area">
<pre>
</pre>
</div>
</div>

12
test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Forms.cshtml.cs

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components
{
public class FormsModel : PageModel
{
public void OnGet()
{
}
}
}

42
test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Grids.cshtml

@ -14,13 +14,13 @@
<div class="demo-area">
<abp-container>
<abp-row>
<abp-column size-sm="C6">One of two columns</abp-column>
<abp-column size-sm="C6">One of two columns</abp-column>
<abp-column size-sm="_6">One of two columns</abp-column>
<abp-column size-sm="_6">One of two columns</abp-column>
</abp-row>
<abp-row>
<abp-column size-sm="C4">One of three columns</abp-column>
<abp-column size-sm="C4">One of three columns</abp-column>
<abp-column size-sm="C4">One of three columns</abp-column>
<abp-column size-sm="_4">One of three columns</abp-column>
<abp-column size-sm="_4">One of three columns</abp-column>
<abp-column size-sm="_4">One of three columns</abp-column>
</abp-row>
</abp-container>
</div>
@ -144,24 +144,24 @@
<div class="demo-area">
<abp-container>
<abp-row h-align="Start">
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
</abp-row>
<abp-row h-align="Center">
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
</abp-row>
<abp-row h-align="End">
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
</abp-row>
<abp-row h-align="Around">
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
</abp-row>
<abp-row h-align="Between">
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="C4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
<abp-column size="_4">One of three columns</abp-column>
</abp-row>
</abp-container>
</div>
@ -200,8 +200,8 @@
<abp-container>
<abp-row>
<abp-column> First, but unordered</abp-column>
<abp-column order="C12">Second, but last</abp-column>
<abp-column order="C1">Third, but first</abp-column>
<abp-column order="_12">Second, but last</abp-column>
<abp-column order="_1">Third, but first</abp-column>
</abp-row>
<abp-row>
<abp-column> First, but unordered</abp-column>
@ -234,14 +234,14 @@
<div class="demo-area">
<abp-row>
<abp-column> .col-md-4</abp-column>
<abp-column size-md="C4" offset-md="C4">.col-md-4 .offset-md-4</abp-column>
<abp-column size-md="_4" offset-md="_4">.col-md-4 .offset-md-4</abp-column>
</abp-row>
<abp-row>
<abp-column size-md="C3" offset-md="C3">.col-md-3 .offset-md-3</abp-column>
<abp-column size-md="C3" offset-md="C3">.col-md-3 .offset-md-3</abp-column>
<abp-column size-md="_3" offset-md="_3">.col-md-3 .offset-md-3</abp-column>
<abp-column size-md="_3" offset-md="_3">.col-md-3 .offset-md-3</abp-column>
</abp-row>
<abp-row>
<abp-column size-md="C6" offset-md="C3">.col-md-6 .offset-md-3</abp-column>
<abp-column size-md="_6" offset-md="_3">.col-md-6 .offset-md-3</abp-column>
</abp-row>
</div>
<div class="code-area">

1
test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Index.cshtml

@ -10,5 +10,6 @@
<li><a asp-page="Components/Buttons">Buttons</a></li>
<li><a asp-page="Components/Grids">Grids</a></li>
<li><a asp-page="Components/Cards">Cards</a></li>
<li><a asp-page="Components/Forms">Forms</a></li>
</ul>

Loading…
Cancel
Save