signal-desktop/js/views/contact_list_view.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-04-27 21:25:04 +00:00
(function() {
'use strict';
window.Whisper = window.Whisper || {};
2018-04-27 21:25:04 +00:00
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;
2018-04-27 21:25:04 +00:00
this.listenTo(this.model, 'change', this.render);
},
render_attributes: function() {
if (this.model.id === this.ourNumber) {
return {
title: i18n('me'),
number: this.model.getNumber(),
avatar: this.model.getAvatar(),
};
}
2018-04-27 21:25:04 +00:00
return {
class: 'clickable',
title: this.model.getTitle(),
number: this.model.getNumber(),
avatar: this.model.getAvatar(),
profileName: this.model.getProfileName(),
isVerified: this.model.isVerified(),
verified: i18n('verified'),
};
},
showIdentity: function() {
if (this.model.id === this.ourNumber) {
return;
}
var view = new Whisper.KeyVerificationPanelView({
model: this.model,
});
this.listenBack(view);
},
}),
});
})();