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_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/>
|
||||
<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}}
|
||||
<br />
|
||||
</td>
|
||||
|
|
|
@ -245,19 +245,13 @@ function process_hotkey(code) {
|
|||
}
|
||||
|
||||
function process_goto_hotkey(code) {
|
||||
var parent, zephyr_class, zephyr_instance;
|
||||
switch (code) {
|
||||
case 67: // 'c': narrow by recipient
|
||||
parent = get_selected_zephyr_row();
|
||||
zephyr_class = parent.find("span.zephyr_class").text();
|
||||
narrow_class(zephyr_class);
|
||||
narrow_class();
|
||||
break;
|
||||
|
||||
case 73: // 'i': narrow by instance
|
||||
parent = get_selected_zephyr_row();
|
||||
zephyr_class = parent.find("span.zephyr_class").text();
|
||||
zephyr_instance = parent.find("span.zephyr_instance").text();
|
||||
narrow_instance(zephyr_class, zephyr_instance);
|
||||
narrow_instance();
|
||||
break;
|
||||
|
||||
case 80: // 'p': narrow to personals
|
||||
|
@ -378,21 +372,26 @@ function narrow_personals() {
|
|||
});
|
||||
}
|
||||
|
||||
function narrow_class(class_name) {
|
||||
var message = "Showing <span class='label zephyr_class'>" + class_name + "</span>";
|
||||
function narrow_class() {
|
||||
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) {
|
||||
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) {
|
||||
var message = "Showing <span class='label zephyr_class'>" + class_name
|
||||
+ "</span> <span class='label zephyr_instance'>" + instance + "</span>";
|
||||
function narrow_instance() {
|
||||
var parent = get_selected_zephyr_row();
|
||||
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) {
|
||||
return (element.find("span.zephyr_class").length > 0 &&
|
||||
element.find("span.zephyr_class").text() === class_name &&
|
||||
element.find("span.zephyr_instance").text() === instance);
|
||||
element.find("span.zephyr_class").text() === zephyr_class &&
|
||||
element.find("span.zephyr_instance").text() === zephyr_instance);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue