mirror of https://github.com/zulip/zulip.git
Rework display of personals
Code cleanup, and add an arrow to indicate sender and recipient (imported from commit 24881ee1e5f3bc9209f9ec485195dcd7178d86fb)
This commit is contained in:
parent
6e88482977
commit
03a087a654
|
@ -16,7 +16,13 @@
|
|||
<td class="pointer">{% if user_profile.pointer == zephyr.id %}<p id="selected">▶{% 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 %}
|
||||
←
|
||||
{% endif %}
|
||||
|
||||
<span onclick="prepare_personal('{{ zephyr.sender.user.username }}')" class="label zephyr_sender">{{ zephyr.sender.user.username }}</span><br />
|
||||
{{ zephyr.content }}
|
||||
</p></td>
|
||||
|
|
|
@ -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>"
|
||||
+ " ← ";
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue