Browse Source

Used Today instead of the date components

pull/13269/head
malik masis 4 years ago
parent
commit
de5ab98c27
  1. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs
  2. 11
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml
  3. 32
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs
  4. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/Format.cshtml
  5. 30
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/FormatViewComponent.cs
  6. 5
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/Today.cshtml
  7. 12
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/TodayViewComponent.cs
  8. 30
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml
  9. 2
      modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/CmsKitContentWidgetOptions.cs

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs

@ -153,7 +153,7 @@ public class CmsKitWebUnifiedModule : AbpModule
Configure<CmsKitContentWidgetOptions>(options =>
{
options.AddWidget("ExComment", "CommentDate", "DecisionCommentDate");
options.AddWidget("Today", "CmsToday", "Format");
});
}

11
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDate.cshtml

@ -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>
}

32
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDateViewComponent.cs

@ -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;
}

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/DecisionCommentDate.cshtml → modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/Format.cshtml

@ -2,5 +2,5 @@
@model DecisionCommentDateViewModel
<div class="form-check mb-3">
<abp-input asp-for="IsShow" />
<abp-input asp-for="Format" />
</div>

30
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/FormatViewComponent.cs

@ -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; }
}

5
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/Today.cshtml

@ -0,0 +1,5 @@
@model Volo.CmsKit.ViewComponents.TodayViewComponent
<p>Welcome Today Component</p>
<p> @DateTime.Now.ToString(Model.Format)</p>

12
modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/CommentDateViewComponent.cs → modules/cms-kit/host/Volo.CmsKit.Web.Unified/ViewComponents/TodayViewComponent.cs

@ -9,17 +9,17 @@ namespace Volo.CmsKit.ViewComponents;
AutoInitialize = true
)]
[ViewComponent(Name = "CommentDate")]
public class CommentDateViewComponent : AbpViewComponent
[ViewComponent(Name = "CmsToday")]
public class TodayViewComponent : AbpViewComponent
{
public bool IsShow { get; set; }
public string Format { get; set; }
public CommentDateViewComponent()
public TodayViewComponent()
{
}
public virtual async Task<IViewComponentResult> InvokeAsync(string isShow)
public virtual async Task<IViewComponentResult> InvokeAsync(string format)
{
return View("~/ViewComponents/CommentDate.cshtml", new CommentDateViewComponent() { IsShow = bool.Parse(isShow) });
return View("~/ViewComponents/Today.cshtml", new TodayViewComponent() { Format = format });
}
}

30
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Contents/AddWidgetModal.cshtml

@ -20,23 +20,25 @@
<abp-modal-body>
<div class="container">
@if (Model.Widgets.Count() > 1)
{
<abp-select asp-for="ViewModel.Widget" />
{
<abp-select asp-for="ViewModel.Widget" />
foreach (var item in Model.ViewModel.Details)
foreach (var item in Model.ViewModel.Details)
{
if (item.EditorComponentName is not null)
{
<div hidden id="editor-@item.Name">
<form data-check-form-on-close="false">
@await Component.InvokeAsync(@item.EditorComponentName)
</form>
</div>
}
}
}
else
{
<div hidden id="editor-@item.Name">
<form data-check-form-on-close="false">
@await Component.InvokeAsync(@item.EditorComponentName)
</form>
</div>
<p>@L["PleaseConfigureWidgets"].Value</p>
}
}
else
{
<p>@L["PleaseConfigureWidgets"].Value</p>
}
</div>
</abp-modal-body>
<abp-modal-footer>

2
modules/cms-kit/src/Volo.CmsKit.Common.Application/Volo/CmsKit/Contents/CmsKitContentWidgetOptions.cs

@ -11,7 +11,7 @@ public class CmsKitContentWidgetOptions
WidgetConfigs = new();
}
public void AddWidget(string widgetKey, string widgetName, string editorWidgetName)
public void AddWidget(string widgetKey, string widgetName, string editorWidgetName = null)
{
var config = new ContentWidgetConfig(widgetName, editorWidgetName);
WidgetConfigs.Add(widgetKey, config);

Loading…
Cancel
Save