From 475aa99c52d20c27710ba7b7db73531d5b7109d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 8 Dec 2017 11:45:10 +0300 Subject: [PATCH] Added vujs for identity user list. --- .../Pages/Identity/Users/Index.cshtml | 2 +- .../modules/identity/views/users/index.js | 147 ++++++++++-------- 2 files changed, 80 insertions(+), 69 deletions(-) diff --git a/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml b/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml index 3a8300ef79..f9061ab4d4 100644 --- a/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml +++ b/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml @@ -22,7 +22,7 @@

@L["Users"]

- diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js index c1929c8ebf..6844c051bb 100644 --- a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js @@ -1,87 +1,98 @@ -$(function () { +(function() { + var _l = abp.localization.getResource('AbpIdentityWeb'); //TODO: AbpIdentityWeb to const - var _identityUserAppService = volo.abp.identity.identityUser; + var _editModal = new abp.ModalManager({ + viewUrl: abp.appPath + 'Identity/Users/EditModal' + }); + var _createModal = new abp.ModalManager({ viewUrl: abp.appPath + 'Identity/Users/CreateModal' }); - var _editModal = new abp.ModalManager({ - viewUrl: abp.appPath + 'Identity/Users/EditModal' + var app = new Vue({ + el: '#IdentityUsersWrapper', + data: { + + }, + methods: { + openCreateModal: function () { + _createModal.open(); + } + } }); - var _$wrapper = $('#IdentityUsersWrapper'); - var _$table = _$wrapper.find('table'); + $(function () { + + var _$wrapper = $('#IdentityUsersWrapper'); + var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable({ - order: [[1, "asc"]], - ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), - columnDefs: [ - { - targets: 0, - data: null, - orderable: false, - autoWidth: false, - defaultContent: '', - render: function (list, type, record, meta) { - return ''; + var _dataTable = _$table.DataTable({ + order: [[1, "asc"]], + ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), + columnDefs: [ + { + targets: 0, + data: null, + orderable: false, + autoWidth: false, + defaultContent: '', + render: function (list, type, record, meta) { + return ''; + } + }, + { + targets: 1, + data: "userName" + }, + { + targets: 2, + data: "email" + }, + { + targets: 3, + data: "phoneNumber" } - }, - { - targets: 1, - data: "userName" - }, - { - targets: 2, - data: "email" - }, - { - targets: 3, - data: "phoneNumber" - } - ] - }); + ] + }); - //Update user command - _$table.on('click', '.update-user', function () { //TODO: To action list! - _editModal.open({ - id: $(this).data('id') + //Update user command + _$table.on('click', '.update-user', function () { //TODO: To action list! + _editModal.open({ + id: $(this).data('id') + }); }); - }); - //Delete user command - _$table.on('click', '.delete-user', function () { //TODO: To action list! - var id = $(this).data('id'); - var userName = $(this).data('userName'); + //Delete user command + _$table.on('click', '.delete-user', function () { //TODO: To action list! + var id = $(this).data('id'); + var userName = $(this).data('userName'); - if (confirm(_l('UserDeletionConfirmationMessage', userName))) { - _identityUserAppService - .delete(id) - .then(function () { - _dataTable.ajax.reload(); - }); - } - }); + if (confirm(_l('UserDeletionConfirmationMessage', userName))) { + _identityUserAppService + .delete(id) + .then(function () { + _dataTable.ajax.reload(); + }); + } + }); - //Create user command - _$wrapper.find('.create-user-button').click(function () { - _createModal.open(); - }); + _createModal.onClose(function () { //TODO: Only refresh if saved! + _dataTable.ajax.reload(); + }); - _createModal.onClose(function () { //TODO: Only refresh if saved! - _dataTable.ajax.reload(); + _editModal.onClose(function () { //TODO: Only refresh if saved! + _dataTable.ajax.reload(); + }); }); - _editModal.onClose(function() { //TODO: Only refresh if saved! - _dataTable.ajax.reload(); - }); -}); \ No newline at end of file +})();