Added some example widgets for doc

pull/13269/head
malik masis 3 years ago
parent eb6f5df7f1
commit 8b361da7bb

@ -46,6 +46,7 @@ using Volo.CmsKit.Comments;
using Volo.CmsKit.MediaDescriptors;
using Volo.CmsKit.Reactions;
using Volo.CmsKit.Ratings;
using Volo.CmsKit.Contents;
namespace Volo.CmsKit;
@ -152,6 +153,11 @@ public class CmsKitWebUnifiedModule : AbpModule
{
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
Configure<CmsKitContentWidgetOptions>(options =>
{
options.AddWidget("ExComment", "CommentDate", "DecisionCommentDate");
});
}
private void ConfigureCmsKit(ServiceConfigurationContext context)

@ -0,0 +1,11 @@
@model Volo.CmsKit.ViewComponents.CommentDateViewComponent
<p>Welcome Comment Date Component</p>
@if (Model.IsShow)
{
<p> @DateTime.Today.ToLongDateString()</p>
}
else
{
<p>Without date</p>
}

@ -0,0 +1,25 @@
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 = "CommentDate")]
public class CommentDateViewComponent : AbpViewComponent
{
public bool IsShow { get; set; }
public CommentDateViewComponent()
{
}
public virtual async Task<IViewComponentResult> InvokeAsync(string isShow)
{
return View("~/ViewComponents/CommentDate.cshtml", new CommentDateViewComponent() { IsShow = bool.Parse(isShow) });
}
}

@ -0,0 +1,6 @@
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" id="NewOption" />
<label class="form-check-label text-primary d-block" for="NewOption">
Show date in the component
</label>
</div>

@ -0,0 +1,23 @@
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 = "DecisionCommentDate")]
public class DecisionCommentDateViewComponent : AbpViewComponent
{
public DecisionCommentDateViewComponent()
{
}
public virtual async Task<IViewComponentResult> InvokeAsync()
{
return View("~/ViewComponents/DecisionCommentDate.cshtml");
}
}

@ -20,6 +20,12 @@ $(function () {
let html = " <input hidden class=\"properties form-control\" value=\"" + widgetKey + "\" id=\"Code\" type=\"text\" />"
$("#PropertySideId").append(html);
}
else {
var val = $('#NewOption').is(":checked");
let html = " <input hidden class=\"properties form-control\" value=\"" + val + "\" id=\"IsShow\" type=\"text\" />"
$("#PropertySideId").append(html);
}
var keys = [];
var values = [];

@ -40,6 +40,7 @@
{
@await Component.InvokeAsync(contentFragment.GetProperty<string>("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject())
}
}
</abp-card-body>
</abp-card>

Loading…
Cancel
Save