From 6292a4936896f6a58158647c172ac5fe6a50f7ca Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Fri, 29 Dec 2017 10:47:46 +0300 Subject: [PATCH] Merged all JS functions related with datatables into datatables.extensions.js --- .../Pages/Identity/Users/Index.cshtml | 3 +- .../Volo.Abp.Identity.Web.csproj | 4 - .../identity/helpers/datatables.extensions.js | 224 ++++++++++++++++++ .../datatables/datatables.record-actions.js | 176 -------------- .../identity/helpers/datatables_helper.js | 77 ------ 5 files changed, 225 insertions(+), 259 deletions(-) create mode 100644 src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables.extensions.js delete mode 100644 src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables/datatables.record-actions.js delete mode 100644 src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables_helper.js 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 7b06303c4c..ee386d41e1 100644 --- a/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml +++ b/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml @@ -9,11 +9,10 @@ @section scripts { - + - } diff --git a/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj b/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj index e4e756be91..dbc8386f59 100644 --- a/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj +++ b/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj @@ -16,10 +16,6 @@ - - - - diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables.extensions.js b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables.extensions.js new file mode 100644 index 0000000000..257f54a795 --- /dev/null +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/helpers/datatables.extensions.js @@ -0,0 +1,224 @@ +var abp = abp; + +(function ($) { + + + /************************************************************************ + * RECORD-ACTIONS extension for datatables * + *************************************************************************/ + var recordActions = function() { + if (!$.fn.dataTableExt) { + return; + } + + var _createDropdownItem = function (record, fieldItem) { + var $li = $('
  • '); + var $a = $(''); + + if (fieldItem.text) { + $a.html(fieldItem.text); + } + + if (fieldItem.action) { + $a.click(function (e) { + e.preventDefault(); + + if (!$(this).closest('li').hasClass('disabled')) { + fieldItem.action({ + record: record + }); + } + }); + } + + $a.appendTo($li); + return $li; + } + + var _createButtonDropdown = function (record, field) { + var $container = $('
    ') + .addClass('dropdown') + .addClass('action-button'); + + var $dropdownButton = $('' + - '' + - '
    '; - } else { - htmlContent = '-'; //TODO: ...? - } - - return htmlContent; - } - } - }; - -})(); -