mirror of https://github.com/zulip/zulip.git
Get class/instance for narrowing more uniformly
(imported from commit 1e9622cb93cf5954cf94f38c77c191524a6e72bc)
This commit is contained in:
parent
f2fbb99368
commit
7b8544a53f
|
@ -17,10 +17,10 @@
|
||||||
{{/is_personal}}
|
{{/is_personal}}
|
||||||
{{#is_class}}
|
{{#is_class}}
|
||||||
<span class="zephyr_label_clickable zephyr_class"
|
<span class="zephyr_label_clickable zephyr_class"
|
||||||
onclick="select_zephyr({{id}}); narrow_class('{{display_recipient}}');">{{display_recipient}}</span>
|
onclick="select_zephyr({{id}}); narrow_class();">{{display_recipient}}</span>
|
||||||
<br/>
|
<br/>
|
||||||
<span class="zephyr_label_clickable zephyr_instance"
|
<span class="zephyr_label_clickable zephyr_instance"
|
||||||
onclick="select_zephyr({{id}}); narrow_instance('{{display_recipient}}', '{{instance}}');">{{instance}}</span>
|
onclick="select_zephyr({{id}}); narrow_instance();">{{instance}}</span>
|
||||||
{{/is_class}}
|
{{/is_class}}
|
||||||
<br />
|
<br />
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -245,19 +245,13 @@ function process_hotkey(code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_goto_hotkey(code) {
|
function process_goto_hotkey(code) {
|
||||||
var parent, zephyr_class, zephyr_instance;
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 67: // 'c': narrow by recipient
|
case 67: // 'c': narrow by recipient
|
||||||
parent = get_selected_zephyr_row();
|
narrow_class();
|
||||||
zephyr_class = parent.find("span.zephyr_class").text();
|
|
||||||
narrow_class(zephyr_class);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 73: // 'i': narrow by instance
|
case 73: // 'i': narrow by instance
|
||||||
parent = get_selected_zephyr_row();
|
narrow_instance();
|
||||||
zephyr_class = parent.find("span.zephyr_class").text();
|
|
||||||
zephyr_instance = parent.find("span.zephyr_instance").text();
|
|
||||||
narrow_instance(zephyr_class, zephyr_instance);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 80: // 'p': narrow to personals
|
case 80: // 'p': narrow to personals
|
||||||
|
@ -378,21 +372,26 @@ function narrow_personals() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function narrow_class(class_name) {
|
function narrow_class() {
|
||||||
var message = "Showing <span class='label zephyr_class'>" + class_name + "</span>";
|
var parent = get_selected_zephyr_row();
|
||||||
|
var zephyr_class = parent.find("span.zephyr_class").text();
|
||||||
|
var message = "Showing <span class='label zephyr_class'>" + zephyr_class + "</span>";
|
||||||
do_narrow(message, function (element) {
|
do_narrow(message, function (element) {
|
||||||
return (element.find("span.zephyr_class").length > 0 &&
|
return (element.find("span.zephyr_class").length > 0 &&
|
||||||
element.find("span.zephyr_class").text() === class_name);
|
element.find("span.zephyr_class").text() === zephyr_class);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function narrow_instance(class_name, instance) {
|
function narrow_instance() {
|
||||||
var message = "Showing <span class='label zephyr_class'>" + class_name
|
var parent = get_selected_zephyr_row();
|
||||||
+ "</span> <span class='label zephyr_instance'>" + instance + "</span>";
|
var zephyr_class = parent.find("span.zephyr_class").text();
|
||||||
|
var zephyr_instance = parent.find("span.zephyr_instance").text();
|
||||||
|
var message = "Showing <span class='label zephyr_class'>" + zephyr_class
|
||||||
|
+ "</span> <span class='label zephyr_instance'>" + zephyr_instance + "</span>";
|
||||||
do_narrow(message, function (element) {
|
do_narrow(message, function (element) {
|
||||||
return (element.find("span.zephyr_class").length > 0 &&
|
return (element.find("span.zephyr_class").length > 0 &&
|
||||||
element.find("span.zephyr_class").text() === class_name &&
|
element.find("span.zephyr_class").text() === zephyr_class &&
|
||||||
element.find("span.zephyr_instance").text() === instance);
|
element.find("span.zephyr_instance").text() === zephyr_instance);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue