Make the zephyr highlighting for new zephyrs consistent with those on page load.

(imported from commit 28dbdb564b4dff479af1f71551a393f8dd54d597)
This commit is contained in:
Jessica McKellar 2012-08-29 12:53:03 -04:00
parent a7c61d5568
commit 1f56ac9e60
2 changed files with 18 additions and 8 deletions

View File

@ -128,14 +128,23 @@ $(function() {
});
function add_message(index, zephyr) {
var new_str = "<tr id=" + zephyr.id + "> \
<td class='pointer'><p></p></td> \
<td class='zephyr'> \
<p><span onclick='narrow('" + zephyr.display_recipient + "','" + zephyr.id + "')' class='zephyr_class' style='background-color: yellow;'>" + zephyr.display_recipient +
"</span> / <span onclick='narrow_instance('" + zephyr.display_recipient + "','" + zephyr.instance + "','" + zephyr.id + "')' class='zephyr_instance' style='background-color: green;'>" + zephyr.instance + "</span> / " + zephyr.sender + "<br />" +
zephyr.content +
"</p></td> \
</tr>"
var recipient_color;
if (zephyr.type == "class") {
recipient_color = "yellow";
} else {
recipient_color = "magenta";
}
var new_str = "<tr id=" + zephyr.id + ">" +
"<td class='pointer'><p></p></td>" +
"<td class='zephyr'>" +
"<p><span onclick=\"narrow('" + zephyr.display_recipient + "','" + zephyr.id + "')\" class='zephyr_class' style='background-color: " + recipient_color + ";'>" + zephyr.display_recipient +
"</span> / <span onclick=\"narrow_instance('" + zephyr.display_recipient + "','" + zephyr.instance + "','" + zephyr.id + "')\" class='zephyr_instance' style='background-color: green;'>" +
zephyr.instance + "</span> / <span onclick=\"prepare_personal('" + zephyr.sender + "')\" style='background-color: magenta;'>" + zephyr.sender + "</span><br />"
+ zephyr.content +
"</p></td>" +
"</tr>"
alert(new_str);
$("#table tr:last").after(new_str);
}

View File

@ -87,6 +87,7 @@ def get_updates(request):
for zephyr in new_zephyrs:
new_zephyr_list.append({"id": zephyr.id,
"sender": zephyr.sender.user.username,
"type": zephyr.recipient.type,
"display_recipient": get_display_recipient(zephyr.recipient),
"instance": zephyr.instance,
"content": zephyr.content