Show More
user_groups.mako
115 lines
| 3.7 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.mako"/> | ||||
<%def name="title()"> | ||||
${_('User groups 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=""/> | ||||
Bartłomiej Wołyńczyk
|
r2727 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} » <span id="user_group_count">0</span> | ||
r1282 | </%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"> | ||||
%if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')(): | ||||
<li> | ||||
r2068 | <a href="${h.route_path('user_groups_new')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a> | |||
r1282 | </li> | |||
%endif | ||||
</ul> | ||||
</div> | ||||
<div id="repos_list_wrap"> | ||||
<table id="user_group_list_table" class="display"></table> | ||||
</div> | ||||
</div> | ||||
<script> | ||||
$(document).ready(function() { | ||||
Bartłomiej Wołyńczyk
|
r2727 | var $userGroupsListTable = $('#user_group_list_table'); | ||
r1282 | ||||
// user list | ||||
Bartłomiej Wołyńczyk
|
r2727 | $userGroupsListTable.DataTable({ | ||
r1980 | processing: true, | |||
serverSide: true, | ||||
Bartłomiej Wołyńczyk
|
r2727 | ajax: { | ||
"url": "${h.route_path('user_groups_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} user groups ({3} inactive)").format( | ||||
filteredCount, filteredInactiveCount, total, totalInactive); | ||||
if (total === filteredCount) { | ||||
_text = _gettext( | ||||
"{0} user groups ({1} inactive)").format(total, totalInactive); | ||||
} | ||||
$('#user_group_count').text(_text); | ||||
return json.data; | ||||
}, | ||||
}, | ||||
r1282 | dom: 'rtp', | |||
pageLength: ${c.visual.admin_grid_items}, | ||||
order: [[ 0, "asc" ]], | ||||
columns: [ | ||||
r1980 | { data: {"_": "users_group_name", | |||
"sort": "users_group_name"}, title: "${_('Name')}", className: "td-componentname" }, | ||||
{ data: {"_": "description", | ||||
"sort": "description"}, title: "${_('Description')}", className: "td-description" }, | ||||
r1282 | { data: {"_": "members", | |||
r1980 | "sort": "members"}, title: "${_('Members')}", className: "td-number" }, | |||
r1600 | { data: {"_": "sync", | |||
"sort": "sync"}, title: "${_('Sync')}", className: "td-sync" }, | ||||
r1282 | { data: {"_": "active", | |||
r1600 | "sort": "active"}, title: "${_('Active')}", className: "td-active" }, | |||
r1282 | { data: {"_": "owner", | |||
"sort": "owner"}, title: "${_('Owner')}", className: "td-user" }, | ||||
{ data: {"_": "action", | ||||
r1980 | "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false} | |||
r1282 | ], | |||
language: { | ||||
paginate: DEFAULT_GRID_PAGINATION, | ||||
r1980 | sProcessing: _gettext('loading...'), | |||
r1282 | emptyTable: _gettext("No user groups available yet.") | |||
} | ||||
}); | ||||
Bartłomiej Wołyńczyk
|
r2727 | $userGroupsListTable.on('xhr.dt', function(e, settings, json, xhr){ | ||
$userGroupsListTable.css('opacity', 1); | ||||
r1980 | }); | |||
Bartłomiej Wołyńczyk
|
r2727 | $userGroupsListTable.on('preXhr.dt', function(e, settings, data){ | ||
$userGroupsListTable.css('opacity', 0.3); | ||||
r1282 | }); | |||
r1980 | // filter | |||
$('#q_filter').on('keyup', | ||||
$.debounce(250, function() { | ||||
$('#user_group_list_table').DataTable().search( | ||||
$('#q_filter').val() | ||||
).draw(); | ||||
}) | ||||
); | ||||
r1282 | ||||
}); | ||||
</script> | ||||
</%def> | ||||