You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/js/views/contact_list_view.js

53 lines
1.6 KiB
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.ContactListView = Whisper.ListView.extend({
tagName: 'div',
itemView: Whisper.View.extend({
tagName: 'div',
className: 'contact',
templateName: 'contact',
events: {
'click': 'showIdentity'
},
initialize: function(options) {
this.ourNumber = textsecure.storage.user.getNumber();
this.listenBack = options.listenBack;
this.listenTo(this.model, 'change', this.render);
},
render_attributes: function() {
if (this.model.id === this.ourNumber) {
return {
class: 'not-clickable',
title: i18n('me'),
number: this.model.getNumber(),
avatar: this.model.getAvatar()
};
}
return {
class: '',
title: this.model.getTitle(),
number: this.model.getNumber(),
avatar: this.model.getAvatar(),
verified: this.model.isVerified()
};
},
showIdentity: function() {
if (this.model.id === this.ourNumber) {
return;
}
var view = new Whisper.KeyVerificationPanelView({
model: this.model
});
this.listenBack(view);
}
})
});
})();