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 +
{% for name, activity in data.iteritems %} @@ -44,10 +48,14 @@ {% for email, row in activity.sorted_rows %} - + {{ row.full_name }} {{ row.email }} - {{ row.realm }} + + + {{ row.realm }} + + {{ row.send_message_last|date:"M d, H:i" }} {{ row.send_message_count }} {% if activity.has_pointer %} diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index 331a5ca5f7..ab9cdc10f6 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -1786,7 +1786,8 @@ class ActivityTable(object): row = self.rows.setdefault(email, {'realm': domain, 'full_name': full_name, - 'email': email}) + 'email': email, + 'type': 'user'}) row[count_field] = count row[last_visit_field] = last_visit @@ -1795,7 +1796,8 @@ class ActivityTable(object): row = self.rows.setdefault(domain, {'realm': domain, 'full_name': full_name, - 'email': ''}) + 'email': '', + 'type': 'realm'}) row.setdefault(count_field, 0) row[count_field] += count diff --git a/zproject/settings.py b/zproject/settings.py index 0cef88731e..261fdecd40 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -420,6 +420,7 @@ JS_SPECS = { 'activity': { 'source_filenames': ( 'third/sorttable/sorttable.js', + 'js/activity_page.js', ), 'output_filename': 'min/activity.js' },