##// END OF EJS Templates
admin-users: moved grid browsing to pyramid....
admin-users: moved grid browsing to pyramid. - fixed loading data to be lazy fetched. - speeds up loading large user sets significantly

File last commit:

r1520:67ca1dd5 default
r1520:67ca1dd5 default
Show More
users.mako
117 lines | 3.6 KiB | application/x-mako | MakoHtmlLexer
templating: use .mako as extensions for template files.
r1282 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.mako"/>
<%def name="title()">
${_('Users administration')}
%if c.rhodecode_name:
&middot; ${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=""/>
${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_count">0</span>
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='admin')}
</%def>
<%def name="main()">
<div class="box">
<div class="title">
${self.breadcrumbs()}
<ul class="links">
<li>
<a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
</li>
</ul>
</div>
<div id="repos_list_wrap">
<table id="user_list_table" class="display"></table>
</div>
</div>
admin-users: moved grid browsing to pyramid....
r1520 <script type="text/javascript">
templating: use .mako as extensions for template files.
r1282 $(document).ready(function() {
admin-users: moved grid browsing to pyramid....
r1520 var getDatatableCount = function(){
var table = $('#user_list_table').dataTable();
var page = table.api().page.info();
var active = page.recordsDisplay;
var total = page.recordsTotal;
templating: use .mako as extensions for template files.
r1282
admin-users: moved grid browsing to pyramid....
r1520 var _text = _gettext("{0} out of {1} users").format(active, total);
$('#user_count').text(_text);
templating: use .mako as extensions for template files.
r1282 };
// user list
$('#user_list_table').DataTable({
admin-users: moved grid browsing to pyramid....
r1520 processing: false,
serverSide: true,
ajax: "${h.route_path('users_data')}",
templating: use .mako as extensions for template files.
r1282 dom: 'rtp',
pageLength: ${c.visual.admin_grid_items},
admin-users: moved grid browsing to pyramid....
r1520 order: [[ 0, "asc" ]],
templating: use .mako as extensions for template files.
r1282 columns: [
{ data: {"_": "username",
admin-users: moved grid browsing to pyramid....
r1520 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
templating: use .mako as extensions for template files.
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",
admin-users: moved grid browsing to pyramid....
r1520 "sort": "last_activity",
"type": Number}, title: "${_('Last activity')}", className: "td-time", orderable: false },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "active",
admin-users: moved grid browsing to pyramid....
r1520 "sort": "active"}, title: "${_('Active')}", className: "td-active" },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "admin",
admin-users: moved grid browsing to pyramid....
r1520 "sort": "admin"}, title: "${_('Admin')}", className: "td-admin" },
templating: use .mako as extensions for template files.
r1282 { data: {"_": "extern_type",
"sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
{ data: {"_": "action",
"sort": "action"}, title: "${_('Action')}", className: "td-action" }
],
language: {
paginate: DEFAULT_GRID_PAGINATION,
emptyTable: _gettext("No users available yet.")
},
admin-users: moved grid browsing to pyramid....
r1520
templating: use .mako as extensions for template files.
r1282 "createdRow": function ( row, data, index ) {
if (!data['active_raw']){
$(row).addClass('closed')
}
}
});
admin-users: moved grid browsing to pyramid....
r1520 $('#user_list_table').on('xhr.dt', function(e, settings, json, xhr){
$('#user_list_table').css('opacity', 1);
});
$('#user_list_table').on('preXhr.dt', function(e, settings, data){
$('#user_list_table').css('opacity', 0.3);
templating: use .mako as extensions for template files.
r1282 });
admin-users: moved grid browsing to pyramid....
r1520 // refresh counters on draw
$('#user_list_table').on('draw.dt', function(){
getDatatableCount();
templating: use .mako as extensions for template files.
r1282 });
admin-users: moved grid browsing to pyramid....
r1520 // filter
$('#q_filter').on('keyup',
$.debounce(250, function() {
$('#user_list_table').DataTable().search(
$('#q_filter').val()
).draw();
})
);
templating: use .mako as extensions for template files.
r1282
});
</script>
</%def>