Give each zephyr row a unique DOM id

(imported from commit 4530d0bbbfc94fb86ebba9c6d73074de38e4a78a)
This commit is contained in:
Keegan McAllister 2012-09-20 14:33:57 -04:00
parent 48fea66e34
commit 1dabe1cf81
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{{! Client-side Mustache template for rendering zephyrs.}}
<tr zid="{{id}}" class="zephyr_row" onmouseover="select_zephyr_by_id({{id}});">
<tr zid="{{id}}" id="{{dom_id}}" class="zephyr_row" onmouseover="select_zephyr_by_id({{id}});">
<td class="pointer"><p></p></td>
<td class="zephyr_recipient"><p onclick="select_zephyr_by_id({{id}})">
{{#include_recipient}}

View File

@ -505,7 +505,7 @@ function do_narrow(description, original_message, filter_function) {
$.each(initial_zephyr_array, function (dummy, zephyr) {
if (filter_function(zephyr, original_message)) {
// It matched the filter, push it on to the array.
add_to_tables(zephyr, parent, $("#zfilt"));
add_to_tables(zephyr, parent, 'zfilt');
parent = zephyr;
}
});
@ -623,7 +623,9 @@ function update_autocomplete() {
});
}
function add_to_tables(zephyr, parent, table) {
function add_to_tables(zephyr, parent, table_name) {
var table = $('#' + table_name);
if (parent !== undefined &&
zephyr.type === parent.type && (
(zephyr.is_huddle && parent.name === zephyr.name) ||
@ -649,6 +651,8 @@ function add_to_tables(zephyr, parent, table) {
zephyr.include_sender = true;
}
zephyr.dom_id = table_name + zephyr.id;
var new_tr = ich.zephyr(zephyr);
table.append(new_tr);
register_huddle_onclick(new_tr, zephyr.sender);
@ -693,13 +697,13 @@ function add_message(index, zephyr) {
var parent = zephyr_dict[$('#zhome tr:last-child').attr('zid')];
add_to_tables(zephyr, parent, $('#zhome'));
add_to_tables(zephyr, parent, 'zhome');
// now lets see if the filter applies to the message
var parent_filtered = zephyr_dict[$('#zfilt tr:last-child').attr('zid')];
if (current_view_predicate(zephyr, current_view_original_message)) {
add_to_tables(zephyr, parent_filtered, $('#zfilt'));
add_to_tables(zephyr, parent_filtered, 'zfilt');
}