diff --git a/static/js/activity_page.js b/static/js/activity_page.js new file mode 100644 index 0000000000..270a670836 --- /dev/null +++ b/static/js/activity_page.js @@ -0,0 +1,45 @@ +$(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(); +}); diff --git a/templates/zerver/activity.html b/templates/zerver/activity.html index 9e5a4f30ea..124c00bf10 100644 --- a/templates/zerver/activity.html +++ b/templates/zerver/activity.html @@ -21,6 +21,10 @@ {% endfor %} +Show all + +Show summary +