mirror of https://github.com/abpframework/abp.git
7 changed files with 1536 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Badge |
||||
|
{ |
||||
|
|
||||
|
[HtmlTargetElement("a", Attributes = "abp-badge")] |
||||
|
[HtmlTargetElement("span", Attributes = "abp-badge")] |
||||
|
[HtmlTargetElement("a", Attributes = "abp-badge-pill")] |
||||
|
[HtmlTargetElement("span", Attributes = "abp-badge-pill")] |
||||
|
public class AbpBadgeTagHelper : AbpTagHelper<AbpBadgeTagHelper, AbpBadgeTagHelperService> |
||||
|
{ |
||||
|
[HtmlAttributeName("abp-badge")] |
||||
|
public AbpBadgeType BadgeType { get; set; } = AbpBadgeType._; |
||||
|
|
||||
|
[HtmlAttributeName("abp-badge-pill")] |
||||
|
public AbpBadgeType BadgePillType { get; set; } = AbpBadgeType._; |
||||
|
|
||||
|
public AbpBadgeTagHelper(AbpBadgeTagHelperService tagHelperService) |
||||
|
: base(tagHelperService) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
using System.Linq; |
||||
|
using Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Badge |
||||
|
{ |
||||
|
public class AbpBadgeTagHelperService : AbpTagHelperService<AbpBadgeTagHelper> |
||||
|
{ |
||||
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
||||
|
{ |
||||
|
var badgeType = TagHelper.BadgeType != AbpBadgeType._? TagHelper.BadgeType : TagHelper.BadgePillType; |
||||
|
|
||||
|
output.Attributes.AddClass("badge"); |
||||
|
|
||||
|
if (TagHelper.BadgePillType != AbpBadgeType._) |
||||
|
{ |
||||
|
output.Attributes.AddClass("badge-pill"); |
||||
|
} |
||||
|
|
||||
|
if (badgeType != AbpBadgeType.Default && badgeType != AbpBadgeType._) |
||||
|
{ |
||||
|
output.Attributes.AddClass("badge-" + badgeType.ToString().ToLowerInvariant()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Badge |
||||
|
{ |
||||
|
public enum AbpBadgeType |
||||
|
{ |
||||
|
_, |
||||
|
Default, |
||||
|
Primary, |
||||
|
Secondary, |
||||
|
Success, |
||||
|
Danger, |
||||
|
Warning, |
||||
|
Info, |
||||
|
Light, |
||||
|
Dark |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,33 @@ |
|||||
|
@page |
||||
|
@model Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components.BadgesModel |
||||
|
@{ |
||||
|
ViewData["Title"] = "Badges"; |
||||
|
} |
||||
|
|
||||
|
<h2>Badges</h2> |
||||
|
|
||||
|
<p>Based on <a href="https://getbootstrap.com/docs/4.1/components/badges/" target="_blank"> Bootstrap Badge</a>.</p> |
||||
|
|
||||
|
<h4># Badges Examples</h4> |
||||
|
|
||||
|
<div class="demo-with-code"> |
||||
|
<div class="demo-area"> |
||||
|
|
||||
|
<span abp-badge="Primary" >I'm an abp badge!</span> |
||||
|
<span abp-badge-pill="Warning" >I'm an abp pill badge!</span> |
||||
|
<a abp-badge="Danger" href="#">I'm an abp badge link!</a> |
||||
|
<a abp-badge-pill="Success" href="#">I'm an abp pill badge link!</a> |
||||
|
|
||||
|
</div> |
||||
|
<div class="code-area"> |
||||
|
<pre> |
||||
|
<span abp-badge="Primary" >I'm an abp badge!</span> |
||||
|
|
||||
|
<span abp-badge-pill="Warning" >I'm an abp pill badge!</span> |
||||
|
|
||||
|
<a abp-badge="Danger" href="#" >I'm an abp badge link!</a> |
||||
|
|
||||
|
<a abp-badge-pill="Success" href="#" >I'm an abp pill badge link!</a> |
||||
|
</pre> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components |
||||
|
{ |
||||
|
public class BadgesModel : PageModel |
||||
|
{ |
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue