Restyle conversation panel

// FREEBIE
This commit is contained in:
lilia 2016-03-18 13:09:45 -07:00
parent 043a3f9609
commit 18a5ce8e54
8 changed files with 95 additions and 104 deletions

View file

@ -287,6 +287,14 @@
}.bind(this));
},
getName: function() {
if (this.isPrivate()) {
return this.get('name');
} else {
return this.get('name') || 'Unknown group';
}
},
getTitle: function() {
if (this.isPrivate()) {
return this.get('name') || this.getNumber();
@ -338,25 +346,27 @@
this.trigger('change');
}
},
getAvatar: function() {
if (this.avatarUrl === undefined) {
this.updateAvatarUrl(true);
}
var title = this.get('name');
var color = '#999999';
if (this.isPrivate() && title) {
color = COLORS[Math.abs(this.hashCode()) % 15];
}
if (this.avatarUrl) {
return { url: this.avatarUrl };
return { url: this.avatarUrl, color: color };
} else if (this.isPrivate()) {
var title = this.get('name');
if (!title) {
return { content: '#', color: '#999999' };
return { content: '#', color: color };
}
var initials = title.trim()[0];
return {
color: COLORS[Math.abs(this.hashCode()) % 15],
content: initials
};
return { content: initials, color: color };
} else {
return { url: '/images/group_default.png', color: 'gray' };
return { url: '/images/group_default.png', color: color };
}
},

View file

@ -17,7 +17,7 @@
render_attributes: function() {
return {
group: this.model.get('type') === 'group',
title: this.model.getTitle(),
name: this.model.getName(),
number: this.model.getNumber(),
avatar: this.model.getAvatar(),
'view-members' : i18n('members'),
@ -84,7 +84,7 @@
'click .update-group': 'newGroupUpdate',
'click .verify-identity': 'verifyIdentity',
'click .view-members': 'viewMembers',
'click .drop-down': 'toggleMenu',
'click .conversation-menu .hamburger': 'toggleMenu',
'click .openInbox' : 'openInbox',
'click' : 'onClick',
'select .message-list .entry': 'messageDetail',
@ -177,7 +177,7 @@
},
closeMenu: function(e) {
if (e && !$(e.target).hasClass('drop-down')) {
if (e && !$(e.target).hasClass('hamburger')) {
this.$('.menu-list').hide();
}
},
@ -271,7 +271,7 @@
$bottomBar.outerHeight(
this.$messageField.outerHeight() +
$attachmentPreviews.outerHeight() + 1);
$attachmentPreviews.outerHeight() + 10);
this.view.scrollToBottomIfNeeded();
},

View file

@ -110,7 +110,7 @@
},
events: {
'click': 'closeMenu',
'click .hamburger': 'toggleMenu',
'click .global-menu .hamburger': 'toggleMenu',
'click .show-debug-log': 'showDebugLog',
'click .settings': 'showSettings',
'select .gutter .conversation-list-item': 'openConversation',