Rework display of personals

Code cleanup, and add an arrow to indicate sender and recipient

(imported from commit 24881ee1e5f3bc9209f9ec485195dcd7178d86fb)
This commit is contained in:
Keegan McAllister 2012-08-29 15:49:53 -04:00
parent 6e88482977
commit 03a087a654
2 changed files with 21 additions and 12 deletions

View File

@ -16,7 +16,13 @@
<td class="pointer">{% if user_profile.pointer == zephyr.id %}<p id="selected">&#x25b6;{% else %}<p>{% endif %}</p></td>
<td class="zephyr">
<p><span onclick="narrow('{{ zephyr.display_recipient }}', '{{ zephyr.id }}')" class="label {% if zephyr.recipient.type == 'class' %}zephyr_class{% else %}zephyr_personal_recipient{% endif %}">{{ zephyr.display_recipient }}</span>
{% if zephyr.recipient.type == 'class' %}
<span onclick="narrow_instance('{{ zephyr.display_recipient }}', '{{ zephyr.instance }}', '{{ zephyr.id }}')" class="label zephyr_instance">{{ zephyr.instance }}</span>
{% else %}
&larr;
{% endif %}
<span onclick="prepare_personal('{{ zephyr.sender.user.username }}')" class="label zephyr_sender">{{ zephyr.sender.user.username }}</span><br />
{{ zephyr.content }}
</p></td>

View File

@ -152,22 +152,25 @@ $(function() {
});
function add_message(index, zephyr) {
var recipient_class;
if (zephyr.type == "class") {
recipient_class = "zephyr_class";
} else {
recipient_class = "zephyr_personal_recipient";
}
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='label " + recipient_class + "'>" + zephyr.display_recipient +
"</span> <span onclick=\"narrow_instance('" + zephyr.display_recipient + "','" + zephyr.instance + "','" + zephyr.id + "')\" class='label zephyr_instance'>" +
zephyr.instance + "</span> <span onclick=\"prepare_personal('" + zephyr.sender + "')\" class='label zephyr_sender'>" + zephyr.sender + "</span><br />"
"<td class='zephyr'><p>";
if (zephyr.type == "class") {
new_str += "<span onclick=\"narrow('" + zephyr.display_recipient + "','" + zephyr.id
+ "')\" class='label zephyr_class'>" + zephyr.display_recipient + "</span> "
+ "<span onclick=\"narrow_instance('" + zephyr.display_recipient + "','" +
zephyr.instance + "','" + zephyr.id + "')\" class='label zephyr_instance'>" +
zephyr.instance + "</span> ";
} else {
new_str += "<span onclick=\"narrow('" + zephyr.display_recipient + "','" + zephyr.id
+ "')\" class='label zephyr_personal_recipient'>" + zephyr.display_recipient + "</span>"
+ " &larr; ";
}
new_str += "<span onclick=\"prepare_personal('" + zephyr.sender + "')\" class='label zephyr_sender'>"
+ zephyr.sender + "</span><br />"
+ zephyr.content +
"</p></td>" +
"</tr>"
"</tr>";
$("#table tr:last").after(new_str);
}