mirror of https://github.com/abpframework/abp.git
18 changed files with 2478 additions and 4 deletions
File diff suppressed because it is too large
@ -0,0 +1,81 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Volo.CmsKit.Migrations |
||||
|
{ |
||||
|
public partial class Added_GlobalResources : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "TenantName", |
||||
|
table: "AbpAuditLogs", |
||||
|
type: "nvarchar(64)", |
||||
|
maxLength: 64, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldType: "nvarchar(max)", |
||||
|
oldNullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "ImpersonatorTenantName", |
||||
|
table: "AbpAuditLogs", |
||||
|
type: "nvarchar(64)", |
||||
|
maxLength: 64, |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "ImpersonatorUserName", |
||||
|
table: "AbpAuditLogs", |
||||
|
type: "nvarchar(256)", |
||||
|
maxLength: 256, |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.CreateTable( |
||||
|
name: "CmsGlobalResources", |
||||
|
columns: table => new |
||||
|
{ |
||||
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
||||
|
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false), |
||||
|
Value = table.Column<string>(type: "nvarchar(max)", maxLength: 2147483647, nullable: false), |
||||
|
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
||||
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
||||
|
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
||||
|
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
||||
|
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
||||
|
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true) |
||||
|
}, |
||||
|
constraints: table => |
||||
|
{ |
||||
|
table.PrimaryKey("PK_CmsGlobalResources", x => x.Id); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropTable( |
||||
|
name: "CmsGlobalResources"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ImpersonatorTenantName", |
||||
|
table: "AbpAuditLogs"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "ImpersonatorUserName", |
||||
|
table: "AbpAuditLogs"); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "TenantName", |
||||
|
table: "AbpAuditLogs", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldType: "nvarchar(64)", |
||||
|
oldMaxLength: 64, |
||||
|
oldNullable: true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,5 +1,5 @@ |
|||||
{ |
{ |
||||
"ConnectionStrings": { |
"ConnectionStrings": { |
||||
"Default": "Server=(localdb)\\.\\MSSQLLocalDB;Database=CmsKit_Unified;Trusted_Connection=True" |
"Default": "Server=localhost;Database=CmsKit_Unified;Trusted_Connection=True" |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,6 @@ |
|||||
|
namespace Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
public class GlobalResourceUpdateDto |
||||
|
{ |
||||
|
public string Value { get; set; } |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
namespace Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
public class GlobalResourcesDto |
||||
|
{ |
||||
|
public string StyleContent { get; set; } |
||||
|
|
||||
|
public string ScriptContent { get; set; } |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
public interface IGlobalResourceAdminAppService : IApplicationService |
||||
|
{ |
||||
|
Task<GlobalResourcesDto> GetAsync(); |
||||
|
|
||||
|
Task SetGlobalStyleAsync(GlobalResourceUpdateDto input); |
||||
|
|
||||
|
Task SetGlobalScriptAsync(GlobalResourceUpdateDto input); |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.GlobalFeatures; |
||||
|
using Volo.CmsKit.GlobalFeatures; |
||||
|
using Volo.CmsKit.GlobalResources; |
||||
|
using Volo.CmsKit.Permissions; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
[RequiresGlobalFeature(typeof(GlobalResourcesFeature))] |
||||
|
[Authorize(CmsKitAdminPermissions.GlobalResources.Default)] |
||||
|
public class GlobalResourceAdminAppService : ApplicationService, IGlobalResourceAdminAppService |
||||
|
{ |
||||
|
public GlobalResourceManager GlobalResourceManager { get; } |
||||
|
|
||||
|
public GlobalResourceAdminAppService(GlobalResourceManager globalResourceManager) |
||||
|
{ |
||||
|
GlobalResourceManager = globalResourceManager; |
||||
|
} |
||||
|
|
||||
|
public async Task<GlobalResourcesDto> GetAsync() |
||||
|
{ |
||||
|
return new GlobalResourcesDto { |
||||
|
StyleContent = (await GlobalResourceManager.GetGlobalStyleAsync()).Value, |
||||
|
ScriptContent = (await GlobalResourceManager.GetGlobalScriptAsync()).Value |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public async Task SetGlobalStyleAsync(GlobalResourceUpdateDto input) |
||||
|
{ |
||||
|
await GlobalResourceManager.SetGlobalStyleAsync(input.Value); |
||||
|
} |
||||
|
|
||||
|
public async Task SetGlobalScriptAsync(GlobalResourceUpdateDto input) |
||||
|
{ |
||||
|
await GlobalResourceManager.SetGlobalScriptAsync(input.Value); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
// This file is part of GlobalResourcesAdminClientProxy, you can customize it here
|
||||
|
// ReSharper disable once CheckNamespace
|
||||
|
namespace Volo.CmsKit.Admin.Menus.ClientProxies; |
||||
|
|
||||
|
public partial class GlobalResourcesAdminClientProxy |
||||
|
{ |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.GlobalFeatures; |
||||
|
using Volo.CmsKit.GlobalFeatures; |
||||
|
using Volo.CmsKit.Permissions; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
[RequiresGlobalFeature(typeof(GlobalResourcesFeature))] |
||||
|
[RemoteService(Name = CmsKitAdminRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area(CmsKitAdminRemoteServiceConsts.ModuleName)] |
||||
|
[Authorize(CmsKitAdminPermissions.Menus.Default)] |
||||
|
[Route("api/cms-kit-admin/global-resources")] |
||||
|
public class GlobalResourceAdminController: CmsKitAdminController, IGlobalResourceAdminAppService |
||||
|
{ |
||||
|
private readonly IGlobalResourceAdminAppService _globalResourceAdminAppService; |
||||
|
|
||||
|
public GlobalResourceAdminController(IGlobalResourceAdminAppService globalResourceAdminAppService) |
||||
|
{ |
||||
|
_globalResourceAdminAppService = globalResourceAdminAppService; |
||||
|
} |
||||
|
|
||||
|
public Task<GlobalResourcesDto> GetAsync() |
||||
|
{ |
||||
|
return _globalResourceAdminAppService.GetAsync(); |
||||
|
} |
||||
|
|
||||
|
public Task SetGlobalStyleAsync(GlobalResourceUpdateDto input) |
||||
|
{ |
||||
|
return _globalResourceAdminAppService.SetGlobalStyleAsync(input); |
||||
|
} |
||||
|
|
||||
|
public Task SetGlobalScriptAsync(GlobalResourceUpdateDto input) |
||||
|
{ |
||||
|
return _globalResourceAdminAppService.SetGlobalScriptAsync(input); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
@page |
||||
|
|
||||
|
@using Microsoft.AspNetCore.Mvc.Localization |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
||||
|
@using Volo.CmsKit.Admin.Web.Pages.CmsKit.GlobalResources |
||||
|
@using Volo.CmsKit.Admin.Web.Menus |
||||
|
@using Volo.CmsKit.Localization |
||||
|
|
||||
|
@inject IPageLayout PageLayout |
||||
|
@inject IHtmlLocalizer<CmsKitResource> L |
||||
|
|
||||
|
@model IndexModel |
||||
|
|
||||
|
@{ |
||||
|
PageLayout.Content.Title = L["GlobalResources"].Value; |
||||
|
PageLayout.Content.BreadCrumb.Add(L["Menu:CMS"].Value); |
||||
|
PageLayout.Content.MenuItemName = CmsKitAdminMenus.GlobalResources.GlobalResourcesMenu; |
||||
|
} |
||||
|
|
||||
|
@section scripts { |
||||
|
<abp-script-bundle> |
||||
|
<abp-script src="/Pages/CmsKit/GlobalResources/index.js"/> |
||||
|
</abp-script-bundle> |
||||
|
} |
||||
|
|
||||
|
<abp-card> |
||||
|
<abp-card-body> |
||||
|
<abp-tabs> |
||||
|
<abp-tab title="@L["Script"].Value"> |
||||
|
<abp-input asp-for="ScriptContent" suppress-label="true"></abp-input> |
||||
|
</abp-tab> |
||||
|
<abp-tab title="@L["Style"].Value"> |
||||
|
<abp-input asp-for="StyleContent" suppress-label="true"></abp-input> |
||||
|
</abp-tab> |
||||
|
</abp-tabs> |
||||
|
</abp-card-body> |
||||
|
<abp-card-footer> |
||||
|
<abp-button button-type="Primary" id="SaveResourcesButton" class="float-end">@L["SaveChanges"]</abp-button> |
||||
|
</abp-card-footer> |
||||
|
</abp-card> |
||||
@ -0,0 +1,30 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
||||
|
using Volo.CmsKit.Admin.GlobalResources; |
||||
|
|
||||
|
namespace Volo.CmsKit.Admin.Web.Pages.CmsKit.GlobalResources; |
||||
|
|
||||
|
public class IndexModel : CmsKitAdminPageModel |
||||
|
{ |
||||
|
private readonly IGlobalResourceAdminAppService _globalResourceAdminAppService; |
||||
|
|
||||
|
[TextArea(Rows = 30)] |
||||
|
public string ScriptContent { get; set; } |
||||
|
|
||||
|
[TextArea(Rows = 30)] |
||||
|
public string StyleContent { get; set; } |
||||
|
|
||||
|
public IndexModel(IGlobalResourceAdminAppService globalResourceAdminAppService) |
||||
|
{ |
||||
|
_globalResourceAdminAppService = globalResourceAdminAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task OnGetAsync() |
||||
|
{ |
||||
|
var resources = await _globalResourceAdminAppService.GetAsync(); |
||||
|
|
||||
|
ScriptContent = resources.ScriptContent; |
||||
|
StyleContent = resources.StyleContent; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
$(function (){ |
||||
|
var l = abp.localization.getResource("CmsKit"); |
||||
|
|
||||
|
var service = volo.cmsKit.admin.globalResources.globalResourceAdmin; |
||||
|
|
||||
|
$('#SaveResourcesButton').on('click','',function(){ |
||||
|
service.setGlobalStyle($('#StyleContent').val()).then(function () { |
||||
|
service.setGlobalScript($('#ScriptContent').val()).then(function () { |
||||
|
abp.message.success(l("SavedSuccessfully")); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
|
}); |
||||
Loading…
Reference in new issue