Show More
@@ -1,123 +1,123 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="/base/base.mako"/> |
|
3 | 3 | |
|
4 | 4 | <%def name="title()"> |
|
5 | 5 | ${_('Users administration')} |
|
6 | 6 | %if c.rhodecode_name: |
|
7 | 7 | · ${h.branding(c.rhodecode_name)} |
|
8 | 8 | %endif |
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | 11 | <%def name="breadcrumbs_links()"> |
|
12 | 12 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> |
|
13 | 13 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} » <span id="user_count">0</span> |
|
14 | 14 | </%def> |
|
15 | 15 | |
|
16 | 16 | <%def name="menu_bar_nav()"> |
|
17 | 17 | ${self.menu_items(active='admin')} |
|
18 | 18 | </%def> |
|
19 | 19 | |
|
20 | 20 | <%def name="main()"> |
|
21 | 21 | |
|
22 | 22 | <div class="box"> |
|
23 | 23 | |
|
24 | 24 | <div class="title"> |
|
25 | 25 | ${self.breadcrumbs()} |
|
26 | 26 | <ul class="links"> |
|
27 | 27 | <li> |
|
28 | 28 | <a href="${h.route_path('users_new')}" class="btn btn-small btn-success">${_(u'Add User')}</a> |
|
29 | 29 | </li> |
|
30 | 30 | </ul> |
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | <div id="repos_list_wrap"> |
|
34 | 34 | <table id="user_list_table" class="display"></table> |
|
35 | 35 | </div> |
|
36 | 36 | </div> |
|
37 | 37 | |
|
38 | 38 | <script type="text/javascript"> |
|
39 | 39 | |
|
40 | 40 | $(document).ready(function() { |
|
41 | 41 | var $userListTable = $('#user_list_table'); |
|
42 | 42 | // user list |
|
43 | 43 | $userListTable.DataTable({ |
|
44 | 44 | processing: true, |
|
45 | 45 | serverSide: true, |
|
46 | 46 | ajax: { |
|
47 | 47 | "url": "${h.route_path('users_data')}", |
|
48 | 48 | "dataSrc": function ( json ) { |
|
49 | 49 | var filteredCount = json.recordsFiltered; |
|
50 | 50 | var filteredInactiveCount = json.recordsFilteredInactive; |
|
51 | 51 | var totalInactive = json.recordsTotalInactive; |
|
52 | 52 | var total = json.recordsTotal; |
|
53 | 53 | |
|
54 | 54 | var _text = _gettext( |
|
55 | 55 | "{0} ({1} inactive) of {2} users ({3} inactive)").format( |
|
56 | 56 | filteredCount, filteredInactiveCount, total, totalInactive); |
|
57 | 57 | |
|
58 | 58 | if(total === filteredCount){ |
|
59 | 59 | _text = _gettext( |
|
60 | 60 | "{0} users ({1} inactive)").format(total, totalInactive); |
|
61 | 61 | } |
|
62 | 62 | $('#user_count').text(_text); |
|
63 | 63 | return json.data; |
|
64 | 64 | } |
|
65 | 65 | }, |
|
66 | 66 | dom: 'rtp', |
|
67 | 67 | pageLength: ${c.visual.admin_grid_items}, |
|
68 | 68 | order: [[ 0, "asc" ]], |
|
69 | 69 | columns: [ |
|
70 | 70 | { data: {"_": "username", |
|
71 | 71 | "sort": "username"}, title: "${_('Username')}", className: "td-user" }, |
|
72 | 72 | { data: {"_": "email", |
|
73 | 73 | "sort": "email"}, title: "${_('Email')}", className: "td-email" }, |
|
74 | 74 | { data: {"_": "first_name", |
|
75 | 75 | "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" }, |
|
76 | 76 | { data: {"_": "last_name", |
|
77 | 77 | "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" }, |
|
78 | 78 | { data: {"_": "last_activity", |
|
79 | 79 | "sort": "last_activity", |
|
80 | 80 | "type": Number}, title: "${_('Last activity')}", className: "td-time" }, |
|
81 | 81 | { data: {"_": "active", |
|
82 | 82 | "sort": "active"}, title: "${_('Active')}", className: "td-active" }, |
|
83 | 83 | { data: {"_": "admin", |
|
84 |
"sort": "admin"}, title: "${_(' |
|
|
84 | "sort": "admin"}, title: "${_('Super admin')}", className: "td-admin" }, | |
|
85 | 85 | { data: {"_": "extern_type", |
|
86 | 86 | "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" }, |
|
87 | 87 | { data: {"_": "action", |
|
88 | 88 | "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false } |
|
89 | 89 | ], |
|
90 | 90 | language: { |
|
91 | 91 | paginate: DEFAULT_GRID_PAGINATION, |
|
92 | 92 | sProcessing: _gettext('loading...'), |
|
93 | 93 | emptyTable: _gettext("No users available yet.") |
|
94 | 94 | }, |
|
95 | 95 | |
|
96 | 96 | "createdRow": function ( row, data, index ) { |
|
97 | 97 | if (!data['active_raw']){ |
|
98 | 98 | $(row).addClass('closed') |
|
99 | 99 | } |
|
100 | 100 | } |
|
101 | 101 | }); |
|
102 | 102 | |
|
103 | 103 | $userListTable.on('xhr.dt', function(e, settings, json, xhr){ |
|
104 | 104 | $userListTable.css('opacity', 1); |
|
105 | 105 | }); |
|
106 | 106 | |
|
107 | 107 | $userListTable.on('preXhr.dt', function(e, settings, data){ |
|
108 | 108 | $userListTable.css('opacity', 0.3); |
|
109 | 109 | }); |
|
110 | 110 | |
|
111 | 111 | // filter |
|
112 | 112 | $('#q_filter').on('keyup', |
|
113 | 113 | $.debounce(250, function() { |
|
114 | 114 | $userListTable.DataTable().search( |
|
115 | 115 | $('#q_filter').val() |
|
116 | 116 | ).draw(); |
|
117 | 117 | }) |
|
118 | 118 | ); |
|
119 | 119 | |
|
120 | 120 | }); |
|
121 | 121 | </script> |
|
122 | 122 | |
|
123 | 123 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now