User table:

Added button for single user edit
Added delete-trash-icon (not working)
Roles are displayed correct per user
Guest user is not visible if anonymous browsing is disabled
This commit is contained in:
Ozzie Isaacs
2021-01-31 14:54:45 +01:00
parent f45ea1a31c
commit eeb7974e05
4 changed files with 78 additions and 23 deletions

View File

@ -429,7 +429,8 @@ $(function() {
},
});
$("#user-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table",
/*$("#user-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table",
function (e, rowsAfter, rowsBefore) {
var rows = rowsAfter;
@ -440,7 +441,7 @@ $(function() {
var ids = $.map(!$.isArray(rows) ? [rows] : rows, function (row) {
return row.id;
});
});
});*/
});
/* Function for deleting domain restrictions */
@ -472,6 +473,15 @@ function EbookActions (value, row) {
].join("");
}
/* Function for deleting books */
function UserActions (value, row) {
return [
"<div class=\"user-remove\" data-toggle=\"modal\" data-target=\"#GeneralDeleteModal\" data-ajax=\"1\" data-delete-id=\"" + row.id + "\" title=\"Remove\">",
"<i class=\"glyphicon glyphicon-trash\"></i>",
"</div>"
].join("");
}
/* Function for keeping checked rows */
function responseHandler(res) {
$.each(res.rows, function (i, row) {
@ -479,3 +489,23 @@ function responseHandler(res) {
});
return res;
}
function singleUserFormatter(value, row) {
return '<button type="button" className="btn btn-default"><a href="/admin/user/' + row.id + '">' + this.buttontext + '</a></button>'
}
function checkboxFormatter(value, row, index){
if(value & this.column)
return '<input type="checkbox" class="chk" checked onchange="checkboxChange(this, '+index+')">';
else
return '<input type="checkbox" class="chk" onchange="checkboxChange(this, '+index+')">';
}
function checkboxChange(checkbox, index){
$('#user-table').bootstrapTable('updateCell', {
index: index,
field: 'role',
value: checkbox.checked,
reinit: false
});
}