From 83dcb6eeb7a8fd0498b6f176e0bf953521956353 Mon Sep 17 00:00:00 2001 From: malik masis Date: Thu, 14 Jul 2022 14:36:58 +0300 Subject: [PATCH] resolved conflicts --- .../ViewComponents/DecisionCommentDate.cshtml | 12 ++--- .../DecisionCommentDateViewComponent.cs | 13 ++++- .../{Pages => }/_ViewImports.cshtml | 0 .../CmsKit/Contents/AddWidgetModal.cshtml | 16 +++++-- .../Pages/CmsKit/Contents/addWidgetModal.js | 47 ++++++------------- 5 files changed, 43 insertions(+), 45 deletions(-) rename modules/cms-kit/host/Volo.CmsKit.Web.Unified/{Pages => }/_ViewImports.cshtml (100%) 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/Contents/AddWidgetModal.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml index 3219538d46..aaf15898af 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 @@ }
- + + + + \ No newline at end of file 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..8fcae3fa11 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'); }); };