mirror of https://github.com/abpframework/abp.git
6 changed files with 66 additions and 8 deletions
@ -0,0 +1,9 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
|||
{ |
|||
public enum AbpCardImagePosition |
|||
{ |
|||
None, |
|||
Top, |
|||
Bottom |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
|||
{ |
|||
public static class AbpCardImagePositionExtensions |
|||
{ |
|||
public static string ToClassName(this AbpCardImagePosition position) |
|||
{ |
|||
switch (position) |
|||
{ |
|||
case AbpCardImagePosition.None: |
|||
return "card-img"; |
|||
case AbpCardImagePosition.Top: |
|||
return "card-img-top"; |
|||
case AbpCardImagePosition.Bottom: |
|||
return "card-img-bottom"; |
|||
default: |
|||
throw new AbpException("Unknown AbpCardImagePosition: " + position); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
using Microsoft.AspNetCore.Razor.TagHelpers; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
|||
{ |
|||
[HtmlTargetElement("img", Attributes = "abp-card-image", TagStructure = TagStructure.WithoutEndTag)] |
|||
public class AbpCardImageTagHelper : AbpTagHelper<AbpCardImageTagHelper, AbpCardImageTagHelperService> |
|||
{ |
|||
[HtmlAttributeName("abp-card-image")] |
|||
public AbpCardImagePosition Position { get; set; } = AbpCardImagePosition.Top; |
|||
|
|||
public AbpCardImageTagHelper(AbpCardImageTagHelperService tagHelperService) |
|||
: base(tagHelperService) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using Microsoft.AspNetCore.Razor.TagHelpers; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card |
|||
{ |
|||
public class AbpCardImageTagHelperService : AbpTagHelperService<AbpCardImageTagHelper> |
|||
{ |
|||
public override void Process(TagHelperContext context, TagHelperOutput output) |
|||
{ |
|||
output.Attributes.AddClass(TagHelper.Position.ToClassName()); |
|||
output.Attributes.RemoveAll("abp-card-image"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue