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