##// END OF EJS Templates
admin-user-list: expose last activity in exchange to last login....
marcink -
r1254:2ae8ce46 default
parent child Browse files
Show More
@@ -1,142 +1,142 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
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 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${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.url('admin_home'))} &raquo; <span id="user_count">0</span>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <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 <div class="box">
21 <div class="box">
22
22
23 <div class="title">
23 <div class="title">
24 ${self.breadcrumbs()}
24 ${self.breadcrumbs()}
25 <ul class="links">
25 <ul class="links">
26 <li>
26 <li>
27 <a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
27 <a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
28 </li>
28 </li>
29 </ul>
29 </ul>
30 </div>
30 </div>
31
31
32 <div id="repos_list_wrap">
32 <div id="repos_list_wrap">
33 <table id="user_list_table" class="display"></table>
33 <table id="user_list_table" class="display"></table>
34 </div>
34 </div>
35 </div>
35 </div>
36
36
37 <script>
37 <script>
38 $(document).ready(function() {
38 $(document).ready(function() {
39
39
40 var get_datatable_count = function(){
40 var get_datatable_count = function(){
41 var datatable = $('#user_list_table').dataTable();
41 var datatable = $('#user_list_table').dataTable();
42 var api = datatable.api();
42 var api = datatable.api();
43 var total = api.page.info().recordsDisplay;
43 var total = api.page.info().recordsDisplay;
44 var active = datatable.fnGetFilteredData();
44 var active = datatable.fnGetFilteredData();
45 var _text = _gettext("{0} active out of {1} users").format(active, total);
45 var _text = _gettext("{0} active out of {1} users").format(active, total);
46 $('#user_count').text(_text);
46 $('#user_count').text(_text);
47 };
47 };
48
48
49 // custom filter that filters by username OR email
49 // custom filter that filters by username OR email
50 $.fn.dataTable.ext.search.push(
50 $.fn.dataTable.ext.search.push(
51 function( settings, data, dataIndex ) {
51 function( settings, data, dataIndex ) {
52 var query = $('#q_filter').val();
52 var query = $('#q_filter').val();
53
53
54 var username = data[0];
54 var username = data[0];
55 var email = data[1];
55 var email = data[1];
56 var first_name = data[2];
56 var first_name = data[2];
57 var last_name = data[3];
57 var last_name = data[3];
58
58
59 var query_str = username + " " +
59 var query_str = username + " " +
60 email + " " +
60 email + " " +
61 first_name + " " +
61 first_name + " " +
62 last_name;
62 last_name;
63
63
64 if ((query_str).indexOf(query) !== -1) {
64 if ((query_str).indexOf(query) !== -1) {
65 return true;
65 return true;
66 }
66 }
67 return false;
67 return false;
68 }
68 }
69 );
69 );
70 // filtered data plugin
70 // filtered data plugin
71 $.fn.dataTableExt.oApi.fnGetFilteredData = function ( oSettings ) {
71 $.fn.dataTableExt.oApi.fnGetFilteredData = function ( oSettings ) {
72 var res = [];
72 var res = [];
73 for ( var i=0, iLen=oSettings.fnRecordsDisplay() ; i<iLen ; i++ ) {
73 for ( var i=0, iLen=oSettings.fnRecordsDisplay() ; i<iLen ; i++ ) {
74 var record = oSettings.aoData[i]._aData;
74 var record = oSettings.aoData[i]._aData;
75 if(record['active_raw']){
75 if(record['active_raw']){
76 res.push(record);
76 res.push(record);
77 }
77 }
78 }
78 }
79 return res.length;
79 return res.length;
80 };
80 };
81
81
82 // user list
82 // user list
83 $('#user_list_table').DataTable({
83 $('#user_list_table').DataTable({
84 data: ${c.data|n},
84 data: ${c.data|n},
85 dom: 'rtp',
85 dom: 'rtp',
86 pageLength: ${c.visual.admin_grid_items},
86 pageLength: ${c.visual.admin_grid_items},
87 order: [[ 1, "asc" ]],
87 order: [[ 1, "asc" ]],
88 columns: [
88 columns: [
89 { data: {"_": "username",
89 { data: {"_": "username",
90 "sort": "username_raw"}, title: "${_('Username')}", className: "td-user" },
90 "sort": "username_raw"}, title: "${_('Username')}", className: "td-user" },
91 { data: {"_": "email",
91 { data: {"_": "email",
92 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
92 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
93 { data: {"_": "first_name",
93 { data: {"_": "first_name",
94 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
94 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
95 { data: {"_": "last_name",
95 { data: {"_": "last_name",
96 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
96 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
97 { data: {"_": "last_login",
97 { data: {"_": "last_activity",
98 "sort": "last_login_raw",
98 "sort": "last_activity_raw",
99 "type": Number}, title: "${_('Last login')}", className: "td-time" },
99 "type": Number}, title: "${_('Last activity')}", className: "td-time" },
100 { data: {"_": "active",
100 { data: {"_": "active",
101 "sort": "active_raw"}, title: "${_('Active')}", className: "td-active" },
101 "sort": "active_raw"}, title: "${_('Active')}", className: "td-active" },
102 { data: {"_": "admin",
102 { data: {"_": "admin",
103 "sort": "admin_raw"}, title: "${_('Admin')}", className: "td-admin" },
103 "sort": "admin_raw"}, title: "${_('Admin')}", className: "td-admin" },
104 { data: {"_": "extern_type",
104 { data: {"_": "extern_type",
105 "sort": "extern_type"}, title: "${_('Authentication type')}", className: "td-type" },
105 "sort": "extern_type"}, title: "${_('Auth type')}", className: "td-type" },
106 { data: {"_": "action",
106 { data: {"_": "action",
107 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
107 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
108 ],
108 ],
109 language: {
109 language: {
110 paginate: DEFAULT_GRID_PAGINATION,
110 paginate: DEFAULT_GRID_PAGINATION,
111 emptyTable: _gettext("No users available yet.")
111 emptyTable: _gettext("No users available yet.")
112 },
112 },
113 "initComplete": function( settings, json ) {
113 "initComplete": function( settings, json ) {
114 get_datatable_count();
114 get_datatable_count();
115 },
115 },
116 "createdRow": function ( row, data, index ) {
116 "createdRow": function ( row, data, index ) {
117 if (!data['active_raw']){
117 if (!data['active_raw']){
118 $(row).addClass('closed')
118 $(row).addClass('closed')
119 }
119 }
120 }
120 }
121 });
121 });
122
122
123 // update the counter when doing search
123 // update the counter when doing search
124 $('#user_list_table').on( 'search.dt', function (e,settings) {
124 $('#user_list_table').on( 'search.dt', function (e,settings) {
125 get_datatable_count();
125 get_datatable_count();
126 });
126 });
127
127
128 // filter, filter both grids
128 // filter, filter both grids
129 $('#q_filter').on( 'keyup', function () {
129 $('#q_filter').on( 'keyup', function () {
130 var user_api = $('#user_list_table').dataTable().api();
130 var user_api = $('#user_list_table').dataTable().api();
131 user_api
131 user_api
132 .draw();
132 .draw();
133 });
133 });
134
134
135 // refilter table if page load via back button
135 // refilter table if page load via back button
136 $("#q_filter").trigger('keyup');
136 $("#q_filter").trigger('keyup');
137
137
138 });
138 });
139
139
140 </script>
140 </script>
141
141
142 </%def>
142 </%def>
General Comments 0
You need to be logged in to leave comments. Login now