From 61b1702d49560c0f9f157db13d53b9bf37f175f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 23 Apr 2018 17:49:28 +0300 Subject: [PATCH] Added AbpCardLinkTagHelper --- .../TagHelpers/Card/AbpCardBodyTagHelper.cs | 4 ++ .../Card/AbpCardBodyTagHelperService.cs | 13 +++++- .../TagHelpers/Card/AbpCardLinkTagHelper.cs | 14 ++++++ .../Card/AbpCardLinkTagHelperService.cs | 14 ++++++ .../Card/AbpCardTitleTagHelperService.cs | 1 - .../Pages/Components/Cards.cshtml | 44 ++++++++++++------- 6 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelper.cs create mode 100644 src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelperService.cs diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelper.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelper.cs index a79140aeaa..907e3d74aa 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelper.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelper.cs @@ -2,6 +2,10 @@ { public class AbpCardBodyTagHelper : AbpTagHelper { + //public string Title { get; set; } //TODO: ... + + //public string Subtitle { get; set; } //TODO: ... + public AbpCardBodyTagHelper(AbpCardBodyTagHelperService tagHelperService) : base(tagHelperService) { diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs index edd48560ca..5e9a098551 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardBodyTagHelperService.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Razor.TagHelpers; +using System; +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 @@ -9,6 +10,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card { output.TagName = "div"; output.Attributes.AddClass("card-body"); + + //if (!TagHelper.Title.IsNullOrWhiteSpace()) + //{ + // //TODO... + //} + + //if (!TagHelper.Subtitle.IsNullOrWhiteSpace()) + //{ + // //TODO... + //} } } } \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelper.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelper.cs new file mode 100644 index 0000000000..5b591d007d --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelper.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card +{ + [HtmlTargetElement(Attributes = "abp-card-link")] + public class AbpCardLinkTagHelper : AbpTagHelper + { + public AbpCardLinkTagHelper(AbpCardLinkTagHelperService tagHelperService) + : base(tagHelperService) + { + + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelperService.cs new file mode 100644 index 0000000000..5cdba7cdba --- /dev/null +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardLinkTagHelperService.cs @@ -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 AbpCardLinkTagHelperService : AbpTagHelperService + { + public override void Process(TagHelperContext context, TagHelperOutput output) + { + output.Attributes.AddClass("card-link"); + output.Attributes.RemoveAll("abp-card-link"); + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardTitleTagHelperService.cs b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardTitleTagHelperService.cs index 7143f422e2..9ad27a49a0 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardTitleTagHelperService.cs +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Card/AbpCardTitleTagHelperService.cs @@ -5,7 +5,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card { public class AbpCardTitleTagHelperService : AbpTagHelperService { - public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = TagHelper.Heading.ToHtmlTag(); diff --git a/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Cards.cshtml b/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Cards.cshtml index e95284404f..706a58b7a6 100644 --- a/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Cards.cshtml +++ b/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/Cards.cshtml @@ -44,13 +44,23 @@ Card title Card subtitle Some quick example text to build on the card title and make up the bulk of the card's content. - Card link - Another link + Card link + Another link
-

+        
+<abp-card style="width: 18rem;">
+    <abp-card-body>
+        <abp-card-title>Card title</abp-card-title>
+        <abp-card-subtitle class="mb-2 text-muted">Card subtitle</abp-card-subtitle>
+        <abp-card-text>Some quick example text to build on the card title and make up the bulk of the card's content.</abp-card-text>
+        <a abp-card-link href="#">Card link</a>
+        <a abp-card-link href="#">Another link</a>
+    </abp-card-body>
+</abp-card>
+
@@ -58,25 +68,25 @@
-
+ Card image cap -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

+ + Card title + Some quick example text to build on the card title and make up the bulk of the card's content. Go somewhere -
-
+ +
-
-<div class="card" style="width: 18rem;">
-    <img class="card-img-top" src=".../100px180/" alt="Card image cap">
-    <div class="card-body">
-        <h5 class="card-title">Card title</h5>
-        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+        
+<abp-card style="width: 18rem;">
+    <img class="card-img-top" src="~/imgs/demo/300x200.png" alt="Card image cap">
+    <abp-card-body>
+        <abp-card-title>Card title</abp-card-title>
+        <abp-card-text>Some quick example text to build on the card title and make up the bulk of the card's content.</abp-card-text>
         <a href="#" class="btn btn-primary">Go somewhere</a>
-    </div>
-</div>
+    </abp-card-body>
+</abp-card>