mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
add admin role/log feature
This commit is contained in:
48
static/scripts/sysadmin-app/views/admin-login-log.js
Normal file
48
static/scripts/sysadmin-app/views/admin-login-log.js
Normal file
@@ -0,0 +1,48 @@
|
||||
define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common',
|
||||
'moment',
|
||||
'app/views/widgets/hl-item-view'
|
||||
], function($, _, Backbone, Common, Moment, HLItemView) {
|
||||
'use strict';
|
||||
|
||||
var AdminLoginLogView = HLItemView.extend({
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#admin-login-log-item-tmpl').html()),
|
||||
|
||||
events: {
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
HLItemView.prototype.initialize.call(this);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var data = {
|
||||
'email': this.model.get('email'),
|
||||
'login_ip': this.model.get('login_ip'),
|
||||
'login_success': this.model.get('login_success')
|
||||
},
|
||||
login_time = Moment(this.model.get('login_time'));
|
||||
|
||||
data['time'] = login_time.format('LLLL');
|
||||
data['time_from_now'] = Common.getRelativeTimeStr(login_time);
|
||||
|
||||
var user_url = function(user_id) {
|
||||
return app.config.siteRoot + 'useradmin/info/' + encodeURIComponent(user_id) + '/';
|
||||
};
|
||||
|
||||
data.admin_user_url = user_url(data.email);
|
||||
|
||||
this.$el.html(this.template(data));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return AdminLoginLogView;
|
||||
});
|
Reference in New Issue
Block a user