users.mako
126 lines
| 4.0 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.mako"/> | ||||
<%def name="title()"> | ||||
${_('Users administration')} | ||||
%if c.rhodecode_name: | ||||
· ${h.branding(c.rhodecode_name)} | ||||
%endif | ||||
</%def> | ||||
<%def name="breadcrumbs_links()"> | ||||
<input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | ||||
r1758 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} » <span id="user_count">0</span> | |||
r1282 | </%def> | |||
<%def name="menu_bar_nav()"> | ||||
${self.menu_items(active='admin')} | ||||
</%def> | ||||
r3566 | <%def name="menu_bar_subnav()"> | |||
${self.admin_menu(active='users')} | ||||
</%def> | ||||
r1282 | <%def name="main()"> | |||
r1541 | ||||
r1282 | <div class="box"> | |||
<div class="title"> | ||||
<ul class="links"> | ||||
<li> | ||||
r2114 | <a href="${h.route_path('users_new')}" class="btn btn-small btn-success">${_(u'Add User')}</a> | |||
r1282 | </li> | |||
</ul> | ||||
</div> | ||||
<div id="repos_list_wrap"> | ||||
<table id="user_list_table" class="display"></table> | ||||
</div> | ||||
</div> | ||||
r1520 | <script type="text/javascript"> | |||
r1282 | $(document).ready(function() { | |||
r1648 | var $userListTable = $('#user_list_table'); | |||
r1282 | // user list | |||
r1648 | $userListTable.DataTable({ | |||
r1541 | processing: true, | |||
r1520 | serverSide: true, | |||
Bartłomiej Wołyńczyk
|
r2727 | ajax: { | ||
"url": "${h.route_path('users_data')}", | ||||
"dataSrc": function ( json ) { | ||||
var filteredCount = json.recordsFiltered; | ||||
var filteredInactiveCount = json.recordsFilteredInactive; | ||||
var totalInactive = json.recordsTotalInactive; | ||||
var total = json.recordsTotal; | ||||
var _text = _gettext( | ||||
"{0} ({1} inactive) of {2} users ({3} inactive)").format( | ||||
filteredCount, filteredInactiveCount, total, totalInactive); | ||||
if(total === filteredCount){ | ||||
_text = _gettext( | ||||
"{0} users ({1} inactive)").format(total, totalInactive); | ||||
} | ||||
$('#user_count').text(_text); | ||||
return json.data; | ||||
} | ||||
}, | ||||
r1282 | dom: 'rtp', | |||
pageLength: ${c.visual.admin_grid_items}, | ||||
r1520 | order: [[ 0, "asc" ]], | |||
r1282 | columns: [ | |||
{ data: {"_": "username", | ||||
r1520 | "sort": "username"}, title: "${_('Username')}", className: "td-user" }, | |||
r1282 | { data: {"_": "email", | |||
"sort": "email"}, title: "${_('Email')}", className: "td-email" }, | ||||
{ data: {"_": "first_name", | ||||
"sort": "first_name"}, title: "${_('First Name')}", className: "td-user" }, | ||||
{ data: {"_": "last_name", | ||||
"sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" }, | ||||
{ data: {"_": "last_activity", | ||||
r1520 | "sort": "last_activity", | |||
r1547 | "type": Number}, title: "${_('Last activity')}", className: "td-time" }, | |||
r1282 | { data: {"_": "active", | |||
r1520 | "sort": "active"}, title: "${_('Active')}", className: "td-active" }, | |||
r1282 | { data: {"_": "admin", | |||
r3381 | "sort": "admin"}, title: "${_('Super admin')}", className: "td-admin" }, | |||
r1282 | { data: {"_": "extern_type", | |||
"sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" }, | ||||
{ data: {"_": "action", | ||||
r1648 | "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false } | |||
r1282 | ], | |||
language: { | ||||
paginate: DEFAULT_GRID_PAGINATION, | ||||
r1541 | sProcessing: _gettext('loading...'), | |||
r1282 | emptyTable: _gettext("No users available yet.") | |||
}, | ||||
r1520 | ||||
r1282 | "createdRow": function ( row, data, index ) { | |||
if (!data['active_raw']){ | ||||
$(row).addClass('closed') | ||||
} | ||||
} | ||||
}); | ||||
r1648 | $userListTable.on('xhr.dt', function(e, settings, json, xhr){ | |||
$userListTable.css('opacity', 1); | ||||
r1520 | }); | |||
r1648 | $userListTable.on('preXhr.dt', function(e, settings, data){ | |||
$userListTable.css('opacity', 0.3); | ||||
r1282 | }); | |||
r1520 | // filter | |||
$('#q_filter').on('keyup', | ||||
$.debounce(250, function() { | ||||
r1648 | $userListTable.DataTable().search( | |||
r1520 | $('#q_filter').val() | |||
).draw(); | ||||
}) | ||||
); | ||||
r1282 | ||||
}); | ||||
</script> | ||||
</%def> | ||||