aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authormodus75 <modus75@users.noreply.github.com>2016-03-09 21:54:47 +0100
committermodus75 <modus75@users.noreply.github.com>2016-03-09 21:54:47 +0100
commit7dd5029fc63544fa8c7ec8c5646f1fe2d969ce7a (patch)
tree0c3ca4d9b7bf674a08834e3f721baa1f3d4707df /admin
parent4f60f4508c8e7eb84706d48d5600c7bdbaff2532 (diff)
parent8b51eb1b40895358f7ed9dfdfcc0c1f691aeeef9 (diff)
Merge branch 'feature/378-upgrade-datatables'
Diffstat (limited to 'admin')
-rw-r--r--admin/themes/default/template/rating_user.tpl19
-rw-r--r--admin/themes/default/template/user_list.tpl72
2 files changed, 50 insertions, 41 deletions
diff --git a/admin/themes/default/template/rating_user.tpl b/admin/themes/default/template/rating_user.tpl
index bc2b29ad6..e1493832a 100644
--- a/admin/themes/default/template/rating_user.tpl
+++ b/admin/themes/default/template/rating_user.tpl
@@ -65,14 +65,14 @@ body .ui-tooltip {
{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
{combine_script id='jquery.geoip' load='async' path='admin/themes/default/js/jquery.geoip.js'}
{footer_script}
-var oTable = jQuery('#rateTable').dataTable({
- sDom : '<"dtBar"filp>rt<"dtBar"ilp>',
- iDisplayLength: 100,
- aLengthMenu: [ [25, 50, 100, 500, -1], [25, 50, 100, 500, "All"]],
- aaSorting: [], //[[1,'desc']],
- bAutoWidth: false,
- bSortClasses: false,
- aoColumnDefs: [
+jQuery('#rateTable').dataTable({
+ dom : '<"dtBar"filp>rt<"dtBar"ilp>',
+ pageLength: 100,
+ lengthMenu: [ [25, 50, 100, 500, -1], [25, 50, 100, 500, "All"]],
+ sorting: [], //[[1,'desc']],
+ autoWidth: false,
+ sortClasses: false,
+ columnDefs: [
{
aTargets: ["dtc_user"],
sType: "string",
@@ -108,6 +108,7 @@ var oTable = jQuery('#rateTable').dataTable({
]
});
+var oTable = jQuery('#rateTable').DataTable();
function uidFromCell(cell){
var tr = cell;
@@ -135,7 +136,7 @@ $(document).ready( function(){
onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
onSuccess: function(result){
if (result)
- oTable.fnDeleteRow(tr[0]);
+ oTable.row(tr[0]).remove().draw();
else
alert(result);
}
diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl
index dedf59cf6..c25ae0df6 100644
--- a/admin/themes/default/template/user_list.tpl
+++ b/admin/themes/default/template/user_list.tpl
@@ -76,7 +76,7 @@ jQuery(document).ready(function() {
jQuery("#addUserForm .loading").show();
},
success:function(data) {
- oTable.fnDraw();
+ oTable.draw();
jQuery("#addUserForm .loading").hide();
var data = jQuery.parseJSON(data);
@@ -172,7 +172,7 @@ jQuery(document).ready(function() {
/* Formating function for row details */
function fnFormatDetails(oTable, nTr) {
- var userId = oTable.fnGetData(nTr)[0];
+ var userId = oTable.api().row(nTr).data()[0];
console.log("userId = "+userId);
var sOut = null;
@@ -567,7 +567,7 @@ jQuery(document).on('click', '.close-user-details', function(e) {
title:"{/literal}{'Edit user'|translate}{literal}",
href:".user_form_popin",
onClosed: function() {
- oTable.fnDraw();
+ oTable.draw();
}
});
@@ -578,10 +578,10 @@ jQuery(document).on('click', '.close-user-details', function(e) {
/* first column must be prefixed with the open/close icon */
var aoColumns = [
{
- 'bVisible':false
+ visible:false
},
{
- "mRender": function(data, type, full) {
+ render: function(data, type, full) {
return '<label><input type="checkbox" data-user_id="'+full[0]+'"> '+data+'</label> <a title="{/literal}{'Open user details'|translate|escape:'javascript'}{literal}" class="icon-pencil openUserDetails">{/literal}{'edit'|translate}{literal}</a>';
}
}
@@ -592,35 +592,36 @@ jQuery(document).on('click', '.close-user-details', function(e) {
}
var oTable = jQuery('#userList').dataTable({
- "iDisplayLength": 10,
- "bDeferRender": true,
- "bProcessing": true,
- "bServerSide": true,
- "sServerMethod": "POST",
- "sAjaxSource": "admin/user_list_backend.php",
- "oLanguage": {
- "sProcessing": "{/literal}{'Loading...'|translate|escape:'javascript'}{literal}",
- "sLengthMenu": sprintf("{/literal}{'Show %s users'|translate|escape:'javascript'}{literal}", '_MENU_'),
- "sZeroRecords": "{/literal}{'No matching user found'|translate|escape:'javascript'}{literal}",
- "sInfo": sprintf("{/literal}{'Showing %s to %s of %s users'|translate|escape:'javascript'}{literal}", '_START_', '_END_', '_TOTAL_'),
- "sInfoEmpty": "{/literal}{'No matching user found'|translate|escape:'javascript'}{literal}",
- "sInfoFiltered": sprintf("{/literal}{'(filtered from %s total users)'|translate|escape:'javascript'}{literal}", '_MAX_'),
- "sSearch": '<span class="icon-search"></span>'+"{/literal}{'Search'|translate|escape:'javascript'}{literal}",
- "sLoadingRecords": "{/literal}{'Loading...'|translate|escape:'javascript'}{literal}",
- "oPaginate": {
- "sFirst": "{/literal}{'First'|translate|escape:'javascript'}{literal}",
- "sPrevious": '← '+"{/literal}{'Previous'|translate|escape:'javascript'}{literal}",
- "sNext": "{/literal}{'Next'|translate|escape:'javascript'}{literal}"+' →',
- "sLast": "{/literal}{'Last'|translate|escape:'javascript'}{literal}",
+ pageLength: 10,
+ deferRender: true,
+ processing: true,
+ serverSide: true,
+ serverMethod: "POST",
+ ajaxSource: "admin/user_list_backend.php",
+ pagingType: "simple",
+ language: {
+ processing: "{/literal}{'Loading...'|translate|escape:'javascript'}{literal}",
+ lengthMenu: sprintf("{/literal}{'Show %s users'|translate|escape:'javascript'}{literal}", '_MENU_'),
+ zeroRecords: "{/literal}{'No matching user found'|translate|escape:'javascript'}{literal}",
+ info: sprintf("{/literal}{'Showing %s to %s of %s users'|translate|escape:'javascript'}{literal}", '_START_', '_END_', '_TOTAL_'),
+ infoEmpty: "{/literal}{'No matching user found'|translate|escape:'javascript'}{literal}",
+ infoFiltered: sprintf("{/literal}{'(filtered from %s total users)'|translate|escape:'javascript'}{literal}", '_MAX_'),
+ search: '<span class="icon-search"></span>'+"{/literal}{'Search'|translate|escape:'javascript'}{literal}",
+ loadingRecords: "{/literal}{'Loading...'|translate|escape:'javascript'}{literal}",
+ paginate: {
+ first: "{/literal}{'First'|translate|escape:'javascript'}{literal}",
+ previous: '← '+"{/literal}{'Previous'|translate|escape:'javascript'}{literal}",
+ next: "{/literal}{'Next'|translate|escape:'javascript'}{literal}"+' →',
+ last: "{/literal}{'Last'|translate|escape:'javascript'}{literal}",
}
},
- "fnDrawCallback": function( oSettings ) {
+ "drawCallback": function( oSettings ) {
jQuery("#userList input[type=checkbox]").each(function() {
var user_id = jQuery(this).data("user_id");
jQuery(this).prop('checked', (selection.indexOf(user_id) != -1));
});
},
- "aoColumns": aoColumns
+ columns: aoColumns
});
/**
@@ -807,7 +808,7 @@ jQuery(document).on('click', '.close-user-details', function(e) {
jQuery("#applyActionLoading").show();
},
success:function(data) {
- oTable.fnDraw();
+ oTable.draw();
jQuery("#applyActionLoading").hide();
jQuery("#applyActionBlock .infos").show();
@@ -840,11 +841,18 @@ jQuery(document).on('click', '.close-user-details', function(e) {
.dataTables_wrapper, .dataTables_info {clear:none;}
table.dataTable {clear:right;padding-top:10px;}
.dataTable td img {margin-bottom: -6px;margin-left: -6px;}
-.paginate_enabled_previous, .paginate_enabled_previous:hover, .paginate_disabled_previous, .paginate_enabled_next, .paginate_enabled_next:hover, .paginate_disabled_next {background:none;}
-.paginate_enabled_previous, .paginate_enabled_next {color:#005E89 !important;}
-.paginate_enabled_previous:hover, .paginate_enabled_next:hover {color:#D54E21 !important; text-decoration:underline !important;}
-.paginate_disabled_next, .paginate_enabled_next {padding-right:3px;}
+.paginate_button, .paginate_button:hover {background:none !important;}
+.dataTables_wrapper .dataTables_paginate .paginate_button {color:#005E89 !important;}
+.dataTables_wrapper .dataTables_paginate .paginate_button:hover {color:#D54E21 !important; text-decoration:underline !important; border-color:transparent;}
+
+.paginate_button.next {padding-right:3px !important;}
+
+table.dataTable tbody th,
+table.dataTable tbody td {
+ padding: 3px 5px;
+}
+
.bulkAction {margin-top:10px;}
#addUserForm p {margin-left:0;}
#applyActionBlock .actionButtons {margin-left:0;}