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 index 7464d52bc4..0622000bb7 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml @@ -1,6 +1,6 @@ -
- - -
\ No newline at end of file +@using Volo.CmsKit.ViewComponents +@model DecisionCommentDateViewModel + +
+ +
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 index d0586b17a2..c4f52d508a 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs @@ -1,7 +1,10 @@ -using System.Threading.Tasks; +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; @@ -18,6 +21,12 @@ public class DecisionCommentDateViewComponent : AbpViewComponent public virtual async Task InvokeAsync() { - return View("~/ViewComponents/DecisionCommentDate.cshtml"); + return View("~/ViewComponents/DecisionCommentDate.cshtml", new DecisionCommentDateViewModel()); } } + +public class DecisionCommentDateViewModel +{ + [DisplayName("Show date in the component")] + public bool IsShow { get; set; } = true; +} diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/_ViewImports.cshtml similarity index 100% rename from modules/cms-kit/host/Volo.CmsKit.Web.Unified/Pages/_ViewImports.cshtml rename to modules/cms-kit/host/Volo.CmsKit.Web.Unified/_ViewImports.cshtml diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js index 375b7ad41b..086f44e67a 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js @@ -329,9 +329,9 @@ $(function () { }); } - $('#GeneratedWidgetText').on('change', function () { - var txt = $('#GeneratedWidgetText').val(); - editor.insertText(txt); + $('#GeneratedWidgetText').on('change', function (text) { + + editor.insertText(text); }); function createAddWidgetButton() { diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml index 3219538d46..87831e4e1d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml @@ -1,5 +1,6 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.CmsKit.Admin.Web.Pages @using Volo.CmsKit.Localization @using Volo.CmsKit.Admin.Web.Pages.CmsKit.Contents; @@ -20,15 +21,17 @@
@if (Model.Widgets.Count() > 1) { + foreach (var item in Model.ViewModel.Details) { - + } -
-
- } else { @@ -36,4 +39,7 @@ }
+ + + 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 cae289bd1f..2f625fe2fa 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 @@ -3,6 +3,8 @@ $(function () { abp.modals.addWidgetModal = function () { var initModal = function () { + var activeEditor; + var activeForm; let widgetName, widgetType; $("#ViewModel_Widget").change(function () { @@ -11,47 +13,28 @@ $(function () { $('.widget-detail').attr('hidden', 'true'); - $('#editor-' + widgetName).removeAttr('hidden'); - }); + activeEditor = $('#editor-' + widgetName); + activeEditor.removeAttr('hidden'); - $("#save-changes").click(function () { - var widgetKey = $("#WidgetCode").val(); - if (widgetKey != undefined) { - let html = " " - $("#PropertySideId").append(html); - } - else { - - var val = $('#NewOption').is(":checked"); - let html = " " - $("#PropertySideId").append(html); - } + activeForm = $('#editor-' + widgetName + ' form'); + }); - var keys = []; - var values = []; - $(".properties").each(function () { - if (($.trim($(this).val()).length > 0)) { - keys.push(this.id); - values.push($(this).val()); - } - }); + $(".save-changes").click(function () { - let updatedText = ''; - if (widgetType != undefined) { + let properties = activeForm.serializeFormToObject(); - updatedText = "[Widget Type=\"" + widgetType + "\" "; + let widgetText = "[Widget Type=\"" + widgetType + "\" "; - for (var i = 0; i < keys.length; i++) { - updatedText += keys[i] + "=\"" + values[i]; - updatedText += i == (keys.length - 1) ? "\"" : "\" "; + for (var propertyName in properties) { + if (!propertyName.includes(']') && !propertyName.includes('[')) { + widgetText += propertyName + "=\"" + properties[propertyName] + "\" "; } - - updatedText += "]"; } - $('#GeneratedWidgetText').val(updatedText); - $("#GeneratedWidgetText").trigger("change"); + widgetText = widgetText.trim() + "]"; + $('#GeneratedWidgetText').val(widgetText); + $("#GeneratedWidgetText").trigger("change"); $('#addWidgetModal').modal('hide'); }); };