Global resources admin ui

pull/11705/head
Yunus Emre Kalkan 3 years ago
parent 0ed856b862
commit 3c3a2fcc9d

@ -0,0 +1,38 @@
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Modeling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.ClientProxying;
using Volo.CmsKit.Admin.GlobalResources;
// ReSharper disable once CheckNamespace
namespace Volo.CmsKit.Admin.GlobalResources.ClientProxies;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IGlobalResourceAdminAppService), typeof(GlobalResourceAdminClientProxy))]
public partial class GlobalResourceAdminClientProxy : ClientProxyBase<IGlobalResourceAdminAppService>, IGlobalResourceAdminAppService
{
public virtual async Task<GlobalResourcesDto> GetAsync()
{
return await RequestAsync<GlobalResourcesDto>(nameof(GetAsync));
}
public virtual async Task SetGlobalStyleAsync(GlobalResourceUpdateDto input)
{
await RequestAsync(nameof(SetGlobalStyleAsync), new ClientProxyRequestTypeValue
{
{ typeof(GlobalResourceUpdateDto), input }
});
}
public virtual async Task SetGlobalScriptAsync(GlobalResourceUpdateDto input)
{
await RequestAsync(nameof(SetGlobalScriptAsync), new ClientProxyRequestTypeValue
{
{ typeof(GlobalResourceUpdateDto), input }
});
}
}

@ -0,0 +1,7 @@
// This file is part of GlobalResourceAdminClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.CmsKit.Admin.GlobalResources.ClientProxies;
public partial class GlobalResourceAdminClientProxy
{
}

@ -1115,6 +1115,107 @@
}
}
},
"Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController": {
"controllerName": "GlobalResourceAdmin",
"controllerGroupName": "GlobalResourceAdmin",
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceAdminController",
"interfaces": [
{
"type": "Volo.CmsKit.Admin.GlobalResources.IGlobalResourceAdminAppService"
}
],
"actions": {
"GetAsync": {
"uniqueName": "GetAsync",
"name": "GetAsync",
"httpMethod": "GET",
"url": "api/cms-kit-admin/global-resources",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourcesDto",
"typeSimple": "Volo.CmsKit.Admin.GlobalResources.GlobalResourcesDto"
},
"allowAnonymous": false,
"implementFrom": "Volo.CmsKit.Admin.GlobalResources.IGlobalResourceAdminAppService"
},
"SetGlobalStyleAsyncByInput": {
"uniqueName": "SetGlobalStyleAsyncByInput",
"name": "SetGlobalStyleAsync",
"httpMethod": "POST",
"url": "api/cms-kit-admin/global-resources/style",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto, Volo.CmsKit.Admin.Application.Contracts",
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"typeSimple": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"typeSimple": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "System.Void",
"typeSimple": "System.Void"
},
"allowAnonymous": false,
"implementFrom": "Volo.CmsKit.Admin.GlobalResources.IGlobalResourceAdminAppService"
},
"SetGlobalScriptAsyncByInput": {
"uniqueName": "SetGlobalScriptAsyncByInput",
"name": "SetGlobalScriptAsync",
"httpMethod": "POST",
"url": "api/cms-kit-admin/global-resources/script",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto, Volo.CmsKit.Admin.Application.Contracts",
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"typeSimple": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"typeSimple": "Volo.CmsKit.Admin.GlobalResources.GlobalResourceUpdateDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "System.Void",
"typeSimple": "System.Void"
},
"allowAnonymous": false,
"implementFrom": "Volo.CmsKit.Admin.GlobalResources.IGlobalResourceAdminAppService"
}
}
},
"Volo.CmsKit.Admin.Comments.CommentAdminController": {
"controllerName": "CommentAdmin",
"controllerGroupName": "CommentAdmin",

@ -22,16 +22,21 @@ public class GlobalResourceAdminController: CmsKitAdminController, IGlobalResour
_globalResourceAdminAppService = globalResourceAdminAppService;
}
[HttpGet]
public Task<GlobalResourcesDto> GetAsync()
{
return _globalResourceAdminAppService.GetAsync();
}
[HttpPost]
[Route("style")]
public Task SetGlobalStyleAsync(GlobalResourceUpdateDto input)
{
return _globalResourceAdminAppService.SetGlobalStyleAsync(input);
}
[HttpPost]
[Route("script")]
public Task SetGlobalScriptAsync(GlobalResourceUpdateDto input)
{
return _globalResourceAdminAppService.SetGlobalScriptAsync(input);

@ -83,7 +83,7 @@ public class CmsKitAdminMenuContributor : IMenuContributor
CmsKitAdminMenus.GlobalResources.GlobalResourcesMenu,
l["GlobalResources"],
"/Cms/GlobalResources",
"fa fa-memo")
"fa fa-newspaper")
.RequireGlobalFeatures(typeof(GlobalResourcesFeature))
.RequirePermissions(CmsKitAdminPermissions.GlobalResources.Default));

@ -19,6 +19,8 @@
@section scripts {
<abp-script-bundle>
<abp-script src="/client-proxies/cms-kit-common-proxy.js"/>
<abp-script src="/client-proxies/cms-kit-admin-proxy.js"/>
<abp-script src="/Pages/CmsKit/GlobalResources/index.js"/>
</abp-script-bundle>
}

@ -4,8 +4,8 @@ $(function (){
var service = volo.cmsKit.admin.globalResources.globalResourceAdmin;
$('#SaveResourcesButton').on('click','',function(){
service.setGlobalStyle($('#StyleContent').val()).then(function () {
service.setGlobalScript($('#ScriptContent').val()).then(function () {
service.setGlobalStyle({value:$('#StyleContent').val()}).then(function () {
service.setGlobalScript({value:$('#ScriptContent').val()}).then(function () {
abp.message.success(l("SavedSuccessfully"));
});
});

@ -223,6 +223,39 @@
})();
// controller volo.cmsKit.admin.globalResources.globalResourceAdmin
(function(){
abp.utils.createNamespace(window, 'volo.cmsKit.admin.globalResources.globalResourceAdmin');
volo.cmsKit.admin.globalResources.globalResourceAdmin.get = function(ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/cms-kit-admin/global-resources',
type: 'GET'
}, ajaxParams));
};
volo.cmsKit.admin.globalResources.globalResourceAdmin.setGlobalStyle = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/cms-kit-admin/global-resources/style',
type: 'POST',
dataType: null,
data: JSON.stringify(input)
}, ajaxParams));
};
volo.cmsKit.admin.globalResources.globalResourceAdmin.setGlobalScript = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/cms-kit-admin/global-resources/script',
type: 'POST',
dataType: null,
data: JSON.stringify(input)
}, ajaxParams));
};
})();
// controller volo.cmsKit.admin.comments.commentAdmin
(function(){

@ -4,7 +4,7 @@ public class GlobalResourceConsts
{
public const string GlobalStyleName = "GlobalStyle";
public const string GlobalScriptName = "GlobalScripit";
public const string GlobalScriptName = "GlobalScript";
public static int MaxNameLength { get; set; } = 128;

@ -47,7 +47,7 @@
"ExportCSV": "Export CSV",
"Features": "Features",
"GenericDeletionConfirmationMessage": "Are you sure to delete '{0}'?",
"IsActive" : "Active",
"IsActive": "Active",
"LastModification": "Last Modification",
"LastModificationTime": "Last Modification Time",
"LoginToAddComment": "Login to add comment",
@ -159,6 +159,10 @@
"YourFullName": "Your full name",
"YourMessage": "Your Message",
"YourReply": "Your reply",
"MarkdownSupported": "<a href=\"https://www.markdownguide.org/basic-syntax/\">Markdown</a> supported."
"MarkdownSupported": "<a href=\"https://www.markdownguide.org/basic-syntax/\">Markdown</a> supported.",
"GlobalResources": "Global Resources",
"Script": "Script",
"Style": "Style",
"SavedSuccessfully": "Saved successfully"
}
}

@ -159,6 +159,10 @@
"YourFullName": "Tam adınız",
"YourMessage": "Mesajınız",
"YourReply": "Cevabınız",
"MarkdownSupported": "<a href=\"https://www.markdownguide.org/basic-syntax/\">Markdown</a> destekler."
"MarkdownSupported": "<a href=\"https://www.markdownguide.org/basic-syntax/\">Markdown</a> destekler.",
"GlobalResources": "Global Kaynaklar",
"Script": "Script",
"Style": "Style",
"SavedSuccessfully": "Başarıyla kaydedildi"
}
}

@ -43,7 +43,9 @@ public class GlobalResourceManager : DomainService
resource.SetValue(value);
return await _globalResourceRepository.UpdateAsync(resource);
await _globalResourceRepository.UpdateAsync(resource);
return resource;
}
protected virtual async Task<GlobalResource> GetOrCreateResourceAsync(string name)

Loading…
Cancel
Save