From 8b361da7bb8babb53799f1ae42932d8afbb9e607 Mon Sep 17 00:00:00 2001 From: malik masis Date: Thu, 14 Jul 2022 10:12:26 +0300 Subject: [PATCH] Added some example widgets for doc --- .../CmsKitWebUnifiedModule.cs | 6 +++++ .../ViewComponents/CommentDate.cshtml | 11 ++++++++ .../CommentDateViewComponent.cs | 25 +++++++++++++++++++ .../ViewComponents/DecisionCommentDate.cshtml | 6 +++++ .../DecisionCommentDateViewComponent.cs | 23 +++++++++++++++++ .../Pages/CmsKit/Contents/addWidgetModal.js | 6 +++++ .../Pages/Public/CmsKit/Pages/Index.cshtml | 1 + 7 files changed, 78 insertions(+) create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDateViewComponent.cs create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml create mode 100644 modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index 9a6be48e5f..5e953e82d6 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -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(options => + { + options.AddWidget("ExComment", "CommentDate", "DecisionCommentDate"); + }); } private void ConfigureCmsKit(ServiceConfigurationContext context) diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml new file mode 100644 index 0000000000..7921c0ecbd --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml @@ -0,0 +1,11 @@ +@model Volo.CmsKit.ViewComponents.CommentDateViewComponent + +

Welcome Comment Date Component

+@if (Model.IsShow) +{ +

@DateTime.Today.ToLongDateString()

+} +else +{ +

Without date

+} \ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDateViewComponent.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDateViewComponent.cs new file mode 100644 index 0000000000..4122bb1481 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDateViewComponent.cs @@ -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 InvokeAsync(string isShow) + { + return View("~/ViewComponents/CommentDate.cshtml", new CommentDateViewComponent() { IsShow = bool.Parse(isShow) }); + } +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml new file mode 100644 index 0000000000..7464d52bc4 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml @@ -0,0 +1,6 @@ +
+ + +
\ No newline at end of file diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs new file mode 100644 index 0000000000..d0586b17a2 --- /dev/null +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs @@ -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 InvokeAsync() + { + return View("~/ViewComponents/DecisionCommentDate.cshtml"); + } +} diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js index 2c307c8faf..cae289bd1f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/addWidgetModal.js @@ -20,6 +20,12 @@ $(function () { let html = " " $("#PropertySideId").append(html); } + else { + + var val = $('#NewOption').is(":checked"); + let html = " " + $("#PropertySideId").append(html); + } var keys = []; var values = []; diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml index 5a92ae2b04..2aa3c0ce8b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/Public/CmsKit/Pages/Index.cshtml @@ -40,6 +40,7 @@ { @await Component.InvokeAsync(contentFragment.GetProperty("Type"), contentFragment.ExtraProperties.ConvertToDynamicObject()) } + }