mirror of https://github.com/abpframework/abp.git
9 changed files with 60 additions and 66 deletions
@ -1,11 +0,0 @@ |
|||
@model Volo.CmsKit.ViewComponents.CommentDateViewComponent |
|||
|
|||
<p>Welcome Comment Date Component</p> |
|||
@if (Model.IsShow) |
|||
{ |
|||
<p> @DateTime.Today.ToLongDateString()</p> |
|||
} |
|||
else |
|||
{ |
|||
<p>Without date</p> |
|||
} |
|||
@ -1,32 +0,0 @@ |
|||
using System.ComponentModel; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.CmsKit.ViewComponents; |
|||
|
|||
[Widget( |
|||
AutoInitialize = true |
|||
)] |
|||
|
|||
[ViewComponent(Name = "DecisionCommentDate")] |
|||
public class DecisionCommentDateViewComponent : AbpViewComponent |
|||
{ |
|||
public DecisionCommentDateViewComponent() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<IViewComponentResult> InvokeAsync() |
|||
{ |
|||
return View("~/ViewComponents/DecisionCommentDate.cshtml", new DecisionCommentDateViewModel()); |
|||
} |
|||
} |
|||
|
|||
public class DecisionCommentDateViewModel |
|||
{ |
|||
[DisplayName("Show date in the component")] |
|||
public bool IsShow { get; set; } = true; |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using System.ComponentModel; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace Volo.CmsKit.ViewComponents; |
|||
|
|||
[Widget( |
|||
AutoInitialize = true |
|||
)] |
|||
|
|||
[ViewComponent(Name = "Format")] |
|||
public class FormatViewComponent : AbpViewComponent |
|||
{ |
|||
public FormatViewComponent() |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<IViewComponentResult> InvokeAsync() |
|||
{ |
|||
return View("~/ViewComponents/Format.cshtml", new DecisionCommentDateViewModel()); |
|||
} |
|||
} |
|||
|
|||
public class DecisionCommentDateViewModel |
|||
{ |
|||
[DisplayName("Format your date in the component")] |
|||
public string Format { get; set; } |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
@model Volo.CmsKit.ViewComponents.TodayViewComponent |
|||
|
|||
<p>Welcome Today Component</p> |
|||
|
|||
<p> @DateTime.Now.ToString(Model.Format)</p> |
|||
Loading…
Reference in new issue