# HG changeset patch # User Marcin Kuzminski # Date 2018-04-25 13:28:01 # Node ID a9ece9dda584f9ac4b7abebe8c689ec052e25fa2 # Parent c09398305b7577e6bbb52ceb612801988a0b7c7f datatables: use new way of generating labels for count of dynamic datatables. - according to docs this is a better way. We'll use this in other places with some added changes. diff --git a/rhodecode/templates/admin/permissions/permissions_ssh_keys.mako b/rhodecode/templates/admin/permissions/permissions_ssh_keys.mako --- a/rhodecode/templates/admin/permissions/permissions_ssh_keys.mako +++ b/rhodecode/templates/admin/permissions/permissions_ssh_keys.mako @@ -22,21 +22,21 @@ $(document).ready(function() { var $sshKeyListTable = $('#ssh_keys_table'); - var getDatatableCount = function(){ - var table = $sshKeyListTable.dataTable(); - var page = table.api().page.info(); - var active = page.recordsDisplay; - var total = page.recordsTotal; - - var _text = _gettext("{0} out of {1} ssh keys").format(active, total); - $('#ssh_keys_count').text(_text); - }; - // user list $sshKeyListTable.DataTable({ processing: true, serverSide: true, - ajax: "${h.route_path('admin_permissions_ssh_keys_data')}", + ajax: { + "url": "${h.route_path('admin_permissions_ssh_keys_data')}", + "dataSrc": function ( json ) { + var filteredCount = json.recordsFiltered; + var total = json.recordsTotal; + + var _text = _gettext("{0} out of {1} ssh keys").format(filteredCount, total); + $('#ssh_keys_count').text(_text); + return json.data; + } + }, dom: 'rtp', pageLength: ${c.visual.admin_grid_items}, order: [[ 0, "asc" ]], @@ -75,11 +75,6 @@ $sshKeyListTable.css('opacity', 0.3); }); - // refresh counters on draw - $sshKeyListTable.on('draw.dt', function(){ - getDatatableCount(); - }); - // filter $('#q_filter').on('keyup', $.debounce(250, function() { diff --git a/rhodecode/templates/forks/forks.mako b/rhodecode/templates/forks/forks.mako --- a/rhodecode/templates/forks/forks.mako +++ b/rhodecode/templates/forks/forks.mako @@ -43,23 +43,15 @@