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