Fixes #198 Squished avatars

Refactor all avatar views to use a shared partial, then change it to a
background image. Requires allowing unsafe-inline styles in the CSP.
This commit is contained in:
lilia 2015-03-23 14:01:18 -07:00
parent 6509561795
commit 20baa795ad
10 changed files with 48 additions and 42 deletions

View file

@ -17,11 +17,10 @@
'use strict';
window.Whisper = window.Whisper || {};
var ContactView = Backbone.View.extend({
var ContactView = Whisper.View.extend({
className: 'contact-detail',
template: $('#contact-detail').html(),
initialize: function(options) {
this.template = $('#contact-detail').html();
Mustache.parse(this.template);
this.conflict = options.conflict;
},
events: {
@ -30,13 +29,12 @@
triggerConflict: function() {
this.$el.trigger('conflict', {conflict: this.conflict});
},
render: function() {
this.$el.html(Mustache.render(this.template, {
render_attributes: function() {
return {
name : this.model.getTitle(),
avatar_url : this.model.getAvatarUrl(),
conflict : this.conflict
}));
return this;
};
}
});