Files
zulip/static/js/activity_page.js
Steve Howell 4d5842cdcd Add summary view to the /activity report.
When you load the activity report, it will just show summary
counts for realms, but if you click on a realm, you will see
details about users in the realms.  You can also click "Show all"
to see an interleaved view of realms and users.

(imported from commit b106557b1fae64d525071afc124b5a8aed319086)
2013-09-25 11:33:11 -04:00

46 lines
1.1 KiB
JavaScript

$(function () {
function show_realms_only() {
$(".table").each(function () {
var table = $(this);
table.find('tbody tr[data-type="user"]').hide();
table.find('tbody tr[data-type="realm"]').show();
});
}
function filter_to_realm(realm) {
$(".table").each(function () {
var table = $(this);
table.find("tbody tr").hide();
var rows = table.find('tbody tr[data-realm="'+realm+'"]');
rows.show();
});
}
function set_up_realm_links() {
$("a.realm").on("click", function () {
var realm = $(this).attr("data-realm");
filter_to_realm(realm);
});
}
function set_up_summary_link() {
$("a.show-summary").on("click", function () {
show_realms_only();
});
}
function set_up_show_all_link() {
$("a.show-all").on("click", function () {
$(".table tbody tr").show();
});
}
show_realms_only();
set_up_realm_links();
set_up_summary_link();
set_up_show_all_link();
});