mirror of https://github.com/abpframework/abp.git
5 changed files with 41 additions and 9 deletions
@ -1,8 +1,13 @@ |
|||||
namespace Volo.CmsKit.Public.GlobalResources; |
using System; |
||||
|
|
||||
|
namespace Volo.CmsKit.Public.GlobalResources; |
||||
|
|
||||
|
[Serializable] |
||||
public class GlobalResourceDto |
public class GlobalResourceDto |
||||
{ |
{ |
||||
public string Name { get; set; } |
public string Name { get; set; } |
||||
|
|
||||
public string Value { get; set; } |
public string Value { get; set; } |
||||
|
|
||||
|
public DateTime? LastModificationTime { get; set; } |
||||
} |
} |
||||
@ -1 +1,3 @@ |
|||||
<link rel="stylesheet" href="@("/cms-kit/global-resources/style?v=" + Guid.NewGuid())"/> |
@model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.GlobalResources.Style.GlobalStyleModel |
||||
|
|
||||
|
<link rel="stylesheet" href="@("/cms-kit/global-resources/style?v=" + Model.LastModificationTimeTimestamp)"/> |
||||
@ -0,0 +1,6 @@ |
|||||
|
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.GlobalResources.Style; |
||||
|
|
||||
|
public class GlobalStyleModel |
||||
|
{ |
||||
|
public long LastModificationTimeTimestamp { get; set; } |
||||
|
} |
||||
@ -1,13 +1,33 @@ |
|||||
using System.Threading.Tasks; |
using System; |
||||
|
using System.Threading.Tasks; |
||||
using Microsoft.AspNetCore.Mvc; |
using Microsoft.AspNetCore.Mvc; |
||||
using Volo.Abp.AspNetCore.Mvc; |
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.CmsKit.Public.GlobalResources; |
||||
|
|
||||
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.GlobalResources.Style; |
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.GlobalResources.Style; |
||||
|
|
||||
public class GlobalStyleViewComponent : AbpViewComponent |
public class GlobalStyleViewComponent : AbpViewComponent |
||||
{ |
{ |
||||
|
protected IGlobalResourcePublicAppService GlobalResourcePublicAppService { get; } |
||||
|
|
||||
|
public GlobalStyleViewComponent(IGlobalResourcePublicAppService globalResourcePublicAppService) |
||||
|
{ |
||||
|
GlobalResourcePublicAppService = globalResourcePublicAppService; |
||||
|
} |
||||
|
|
||||
|
[BindProperty(SupportsGet = true)] |
||||
|
public DateTime? LastModificationTime { get; set; } |
||||
|
|
||||
public async Task<IViewComponentResult> InvokeAsync() |
public async Task<IViewComponentResult> InvokeAsync() |
||||
{ |
{ |
||||
return View("~/Pages/CmsKit/Shared/Components/GlobalResources/Style/Default.cshtml"); |
var lastModificationTime = (await GlobalResourcePublicAppService.GetGlobalStyleAsync())?.LastModificationTime; |
||||
|
var lastModificationTimeTimestamp = (long)(lastModificationTime.HasValue ? lastModificationTime.Value .Subtract(DateTime.UnixEpoch).TotalSeconds: 0); |
||||
|
|
||||
|
return View("~/Pages/CmsKit/Shared/Components/GlobalResources/Style/Default.cshtml", |
||||
|
new GlobalStyleModel() |
||||
|
{ |
||||
|
LastModificationTimeTimestamp = lastModificationTimeTimestamp |
||||
|
}); |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
Loading…
Reference in new issue