From c1fd5cce2a80f24ffdfca4bb2fe165887ef5c6aa Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Wed, 4 Jul 2018 09:22:30 +0300 Subject: [PATCH] Use new datatables simplified configuration. --- .../Volo.Abp.Identity.Web/compilerconfig.json | 9 +- .../wwwroot/pages/identity/roles/index.es5.js | 6 -- .../pages/identity/roles/index.es5.min.js | 1 - .../wwwroot/pages/identity/roles/index.js | 17 +--- .../wwwroot/pages/identity/users/index.es5.js | 92 ------------------- .../pages/identity/users/index.es5.min.js | 1 - .../wwwroot/pages/identity/users/index.js | 25 ++--- .../TenantManagement/Tenants/Index.cshtml | 15 ++- .../compilerconfig.json | 4 - .../multi-tenancy/views/tenants/index.css | 21 ----- .../multi-tenancy/views/tenants/index.es5.js | 6 -- .../views/tenants/index.es5.min.js | 1 - .../multi-tenancy/views/tenants/index.js | 22 +---- .../multi-tenancy/views/tenants/index.less | 39 -------- .../multi-tenancy/views/tenants/index.min.css | 1 - 15 files changed, 23 insertions(+), 237 deletions(-) delete mode 100644 modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.js delete mode 100644 modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.min.js delete mode 100644 modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.js delete mode 100644 modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.min.js delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.css delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.js delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.min.js delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.less delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.min.css diff --git a/modules/identity/src/Volo.Abp.Identity.Web/compilerconfig.json b/modules/identity/src/Volo.Abp.Identity.Web/compilerconfig.json index 3f5b37134d..579e30d5f5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/compilerconfig.json +++ b/modules/identity/src/Volo.Abp.Identity.Web/compilerconfig.json @@ -1,10 +1,3 @@ [ - { - "outputFile": "wwwroot/pages/identity/users/index.css", - "inputFile": "wwwroot/pages/identity/users/index.less" - }, - { - "outputFile": "wwwroot/pages/identity/users/index.es5.js", - "inputFile": "wwwroot/pages/identity/users/index.js" - } + ] \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.js deleted file mode 100644 index bc6107abbc..0000000000 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -$(function () { - $('#IdentityUsersTable').DataTable(); -}); - diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.min.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.min.js deleted file mode 100644 index 9a2c19267e..0000000000 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.es5.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";$(function(){$("#IdentityUsersTable").DataTable()}); \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.js index 22f7d9cf8e..b450fa069c 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/roles/index.js @@ -12,24 +12,18 @@ var _$wrapper = $('#IdentityRolesWrapper'); var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable({ + var _dataTable = _$table.DataTable(abp.libs.datatables.normalizeConfiguration({ order: [[1, "asc"]], ajax: abp.libs.datatables.createAjax(_identityRoleAppService.getList), columnDefs: [ { - targets: 0, - data: null, - orderable: false, - autoWidth: false, - defaultContent: '', rowAction: { - text: ' ' + l('Actions') + ' ', items: [ { text: l('Edit'), visible: function () { - return true; + return true; //TODO: Check permission }, action: function (data) { _editModal.open({ @@ -40,7 +34,7 @@ { text: l('Permissions'), visible: function () { - return true; + return true; //TODO: Check permission }, action: function (data) { _permissionsModal.open({ @@ -52,7 +46,7 @@ { text: l('Delete'), visible: function () { - return true; + return true; //TODO: Check permission }, confirmMessage: function (data) { return l('RoleDeletionConfirmationMessage', data.record.name)}, action: function (data) { @@ -67,11 +61,10 @@ } }, { - targets: 1, data: "name" } ] - }); + })); _createModal.onResult(function () { _dataTable.ajax.reload(); diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.js deleted file mode 100644 index 216ec8285e..0000000000 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -(function ($) { - - var l = abp.localization.getResource('AbpIdentity'); - - var _identityUserAppService = volo.abp.identity.identityUser; - var _editModal = new abp.ModalManager(abp.appPath + 'Identity/Users/EditModal'); - var _createModal = new abp.ModalManager(abp.appPath + 'Identity/Users/CreateModal'); - var _permissionsModal = new abp.ModalManager(abp.appPath + 'AbpPermissionManagement/PermissionManagementModal'); - - $(function () { - - var _$wrapper = $('#IdentityUsersWrapper'); - var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable({ - order: [[1, "asc"]], - ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), - columnDefs: [{ - //TODO: Can we eleminate targets, data, orderable, autoWidth, defaultContent fields or make these values default - targets: 0, - data: null, - orderable: false, - autoWidth: false, - defaultContent: '', - rowAction: { - text: ' ' + l('Actions') + ' ', //TODO: Add icon option and set text as only l('Actions') - items: [{ - //TODO: Allow to add icon - text: l('Edit'), - visible: function visible() { - //TODO: Allow visible to be a boolean for simple cases (and true by default) - return true; - }, - action: function action(data) { - _editModal.open({ - id: data.record.id - }); - } - }, { - text: l('Permissions'), - visible: function visible() { - return true; - }, - action: function action(data) { - _permissionsModal.open({ - providerName: 'User', - providerKey: data.record.id - }); - } - }, { - text: l('Delete'), - visible: function visible() { - return true; - }, - confirmMessage: function confirmMessage(data) { - return l('UserDeletionConfirmationMessage', data.record.userName); - }, - action: function action(data) { - _identityUserAppService['delete'](data.record.id).then(function () { - _dataTable.ajax.reload(); - }); - } - }] - } - }, { - targets: 1, - data: "userName" - }, { - targets: 2, - data: "email" - }, { - targets: 3, - data: "phoneNumber" - }] - }); - - _createModal.onResult(function () { - _dataTable.ajax.reload(); - }); - - _editModal.onResult(function () { - _dataTable.ajax.reload(); - }); - - _$wrapper.find('button[name=CreateUser]').click(function (e) { - e.preventDefault(); - _createModal.open(); - }); - }); -})(jQuery); - diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.min.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.min.js deleted file mode 100644 index cacfd8391f..0000000000 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.es5.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(function(n){var t=abp.localization.getResource("AbpIdentity"),i=volo.abp.identity.identityUser,r=new abp.ModalManager(abp.appPath+"Identity/Users/EditModal"),u=new abp.ModalManager(abp.appPath+"Identity/Users/CreateModal"),f=new abp.ModalManager(abp.appPath+"AbpPermissionManagement/PermissionManagementModal");n(function(){var o=n("#IdentityUsersWrapper"),s=o.find("table"),e=s.DataTable({order:[[1,"asc"]],ajax:abp.libs.datatables.createAjax(i.getList),columnDefs:[{targets:0,data:null,orderable:!1,autoWidth:!1,defaultContent:"",rowAction:{text:'<\/i> '+t("Actions")+' <\/span>',items:[{text:t("Edit"),visible:function(){return!0},action:function(n){r.open({id:n.record.id})}},{text:t("Permissions"),visible:function(){return!0},action:function(n){f.open({providerName:"User",providerKey:n.record.id})}},{text:t("Delete"),visible:function(){return!0},confirmMessage:function(n){return t("UserDeletionConfirmationMessage",n.record.userName)},action:function(n){i["delete"](n.record.id).then(function(){e.ajax.reload()})}}]}},{targets:1,data:"userName"},{targets:2,data:"email"},{targets:3,data:"phoneNumber"}]});u.onResult(function(){e.ajax.reload()});r.onResult(function(){e.ajax.reload()});o.find("button[name=CreateUser]").click(function(n){n.preventDefault();u.open()})})})(jQuery); \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.js b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.js index 9194e61c47..a13dfb5220 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/wwwroot/pages/identity/users/index.js @@ -11,26 +11,18 @@ var _$wrapper = $('#IdentityUsersWrapper'); var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable({ + var _dataTable = _$table.DataTable(abp.libs.datatables.normalizeConfiguration({ order: [[1, "asc"]], ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), columnDefs: [ { - //TODO: Can we eleminate targets, data, orderable, autoWidth, defaultContent fields or make these values default - targets: 0, - data: null, - orderable: false, - autoWidth: false, - defaultContent: '', rowAction: { - text: ' ' + l('Actions') + ' ', //TODO: Add icon option and set text as only l('Actions') items: [ { - //TODO: Allow to add icon text: l('Edit'), - visible: function () { //TODO: Allow visible to be a boolean for simple cases (and true by default) - return true; + visible: function () { + return true; //TODO: Check permission }, action: function (data) { _editModal.open({ @@ -41,7 +33,7 @@ { text: l('Permissions'), visible: function () { - return true; + return true; //TODO: Check permission }, action: function (data) { _permissionsModal.open({ @@ -53,9 +45,9 @@ { text: l('Delete'), visible: function () { - return true; + return true; //TODO: Check permission }, - confirmMessage: function (data) { return l('UserDeletionConfirmationMessage', data.record.userName)}, + confirmMessage: function (data) { return l('UserDeletionConfirmationMessage', data.record.userName); }, action: function (data) { _identityUserAppService .delete(data.record.id) @@ -68,19 +60,16 @@ } }, { - targets: 1, data: "userName" }, { - targets: 2, data: "email" }, { - targets: 3, data: "phoneNumber" } ] - }); + })); _createModal.onResult(function () { _dataTable.ajax.reload(); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml index ec7b51e291..37e9d6eec9 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml @@ -4,9 +4,6 @@ @using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants @model IndexModel @inject IHtmlLocalizer L -@section styles { - -} @section scripts { } @@ -22,13 +19,13 @@ - + - - - - + + + + -
@L["Actions"]@L["TenantName"]
@L["Actions"]@L["TenantName"]
+
\ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/compilerconfig.json b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/compilerconfig.json index 3104320327..21bfad9e88 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/compilerconfig.json +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/compilerconfig.json @@ -1,6 +1,2 @@ [ - { - "outputFile": "wwwroot/modules/multi-tenancy/views/tenants/index.css", - "inputFile": "wwwroot/modules/multi-tenancy/views/tenants/index.less" - } ] \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.css b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.css deleted file mode 100644 index 41fbd4eaf0..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.css +++ /dev/null @@ -1,21 +0,0 @@ -.dataTable { - width: 100% !important; - border-spacing: 0 !important; -} -.table td, -.table th { - padding: 8px 10px; -} -.dataTable tbody tr td button { - cursor: pointer; -} -.dataTable tbody tr td div.dropdown ul.dropdown-menu li { - cursor: pointer; - padding: 5px; -} -.dataTable tbody tr td div.dropdown ul.dropdown-menu li a { - display: block; -} -.dataTable tbody tr td div.dropdown ul.dropdown-menu li:hover { - background: #f4f5f8; -} \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.js deleted file mode 100644 index bc6107abbc..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -$(function () { - $('#IdentityUsersTable').DataTable(); -}); - diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.min.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.min.js deleted file mode 100644 index 9a2c19267e..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.es5.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";$(function(){$("#IdentityUsersTable").DataTable()}); \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.js index 5e0628879c..bfb44f0bcc 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.js +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.js @@ -9,29 +9,18 @@ $(function () { var _$wrapper = $('#TenantsWrapper'); - var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable({ + var _dataTable = _$wrapper.find('table').DataTable(abp.libs.datatables.normalizeConfiguration({ order: [[1, "asc"]], ajax: abp.libs.datatables.createAjax(_tenantAppService.getList), columnDefs: [ { - //TODO: Can we eleminate targets, data, orderable, autoWidth, defaultContent fields or make these values default - targets: 0, - data: null, - orderable: false, - autoWidth: false, - defaultContent: '', rowAction: { - text: ' ' + l('Actions') + ' ', //TODO: Add icon option and set text as only l('Actions') items: [ { - //TODO: Allow to add icon text: l('Edit'), - visible: function () { //TODO: Allow visible to be a boolean for simple cases - return true; - }, + visible: function () { return true; }, //TODO: Check permission action: function (data) { _editModal.open({ id: data.record.id @@ -40,9 +29,7 @@ }, { text: l('Delete'), - visible: function () { - return true; - }, + visible: function () { return true; }, //TODO: Check permission confirmMessage: function (data) { return l('TenantDeletionConfirmationMessage', data.record.name)}, action: function (data) { _tenantAppService @@ -56,11 +43,10 @@ } }, { - targets: 1, data: "name" } ] - }); + })); _createModal.onResult(function () { _dataTable.ajax.reload(); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.less b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.less deleted file mode 100644 index 21adf56097..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.less +++ /dev/null @@ -1,39 +0,0 @@ -//TODO: This code is duplicated for other pages too. Unify them. -.dataTable { - width: 100% !important; - border-spacing: 0 !important; -} - -.table td, .table th { - padding: 8px 10px; -} - -.dataTable { - tbody { - tr { - td { - - button { - cursor: pointer; - } - - div.dropdown { - ul.dropdown-menu { - li { - cursor: pointer; - padding: 5px; - - a { - display: block; - } - } - - li:hover { - background: #f4f5f8; - } - } - } - } - } - } -} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.min.css b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.min.css deleted file mode 100644 index e70b9e330b..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/wwwroot/modules/multi-tenancy/views/tenants/index.min.css +++ /dev/null @@ -1 +0,0 @@ -.dataTable{width:100% !important;border-spacing:0 !important;}.table td,.table th{padding:8px 10px;}.dataTable tbody tr td button{cursor:pointer;}.dataTable tbody tr td div.dropdown ul.dropdown-menu li{cursor:pointer;padding:5px;}.dataTable tbody tr td div.dropdown ul.dropdown-menu li a{display:block;}.dataTable tbody tr td div.dropdown ul.dropdown-menu li:hover{background:#f4f5f8;} \ No newline at end of file