Add sender avatar in message popover.

This commit is contained in:
hackerkid 2017-03-04 02:27:06 +05:30 committed by Tim Abbott
parent 3ac8f52a73
commit 23a5f56023
4 changed files with 32 additions and 6 deletions

View File

@ -662,17 +662,14 @@ function render(template_name, args) {
(function message_info_popover_title() { (function message_info_popover_title() {
var args = { var args = {
message: { sender_avatar: 'avatar/hamlet@zulip.com',
is_stream: true,
stream: 'devel',
},
}; };
var html = render('message_info_popover_title', args); var html = render('message_info_popover_title', args);
global.write_handlebars_output("message_info_popover_title", html); global.write_handlebars_output("message_info_popover_title", html);
html = '<div>' + html + '</div>'; html = '<div>' + html + '</div>';
assert($(html).text().trim(), "Message to stream devel"); assert($(html).find('.popover-avatar').css('background-image'), "url(avatar/hamlet@zulip.com)");
}()); }());
(function message_reaction() { (function message_reaction() {

View File

@ -75,11 +75,18 @@ function show_message_info_popover(element, id) {
elt.popover({ elt.popover({
placement: (ypos > (message_viewport.height() - 300)) ? 'top' : 'bottom', placement: (ypos > (message_viewport.height() - 300)) ? 'top' : 'bottom',
template: templates.render('user_info_popover', {class: "message-info-popover"}), template: templates.render('user_info_popover', {class: "message-info-popover"}),
title: templates.render('message_info_popover_title', args), title: templates.render('message_info_popover_title', {sender_avatar: "avatar/" + sender_email}),
content: templates.render('message_info_popover_content', args), content: templates.render('message_info_popover_content', args),
trigger: "manual", trigger: "manual",
}); });
elt.popover("show"); elt.popover("show");
var sender_avatar_medium = new Image();
sender_avatar_medium.src= "avatar/" + sender_email + "/medium";
$(sender_avatar_medium).load(function () {
$(".popover-avatar").css("background-image","url("+$(this).attr("src")+")");
});
current_message_info_popover_elem = elt; current_message_info_popover_elem = elt;
} }
} }

View File

@ -2634,3 +2634,23 @@ ul.actions_popover i {
text-align: center; text-align: center;
margin-right: 3px; margin-right: 3px;
} }
.user_popover {
top: 100px!important;
}
.popover-inner {
width: 240px;
}
.popover-avatar {
height: 240px;
width: 240px;
background-size: cover;
background-position: center;
margin-top: -8px;
margin-left: -14px;
margin-right: -8px;
margin-bottom: -8px;
position: relative;
}

View File

@ -0,0 +1,2 @@
<div class="popover-avatar" style="background-image: url('{{sender_avatar}}');" >
</div>