From 59ec080a8d93a05f6835cc0ecf344b41a1d928ff Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 7 Nov 2013 10:53:09 -0500 Subject: [PATCH] Simplify analytics/activity.html. For legacy reasons, this template wanted each tab's content as a one-key dictionary, instead of a string. Each tab already has a tuple to allow for fields like title, so this wasn't really giving us any long term flexibility; it was just crufting up the calling code. (imported from commit 2a316107ec223a83efa8735f4810a6fa43107541) --- analytics/views.py | 20 ++++++++------------ templates/analytics/activity.html | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/analytics/views.py b/analytics/views.py index 2a5b637d22..8ab6624c47 100644 --- a/analytics/views.py +++ b/analytics/views.py @@ -142,7 +142,7 @@ def realm_summary_table(realm_minutes): 'analytics/realm_summary_table.html', dict(rows=rows, num_active_sites=num_active_sites) ) - return dict(content=content) + return content def user_activity_intervals(): @@ -193,7 +193,7 @@ def user_activity_intervals(): output += "\nTotal Duration in minutes: %s\n" % (total_duration.total_seconds() / 60.,) output += "Total Duration amortized to a month: %s" % (total_duration.total_seconds() * 30. / 60.,) content = mark_safe('
' + output + '
') - return dict(content=content), realm_minutes + return content, realm_minutes def sent_messages_report(realm): title = 'Recently sent messages for ' + realm @@ -478,7 +478,7 @@ def get_activity(request, realm=REQ(default=None)): ('Durations', duration_content), ] for page in ad_hoc_queries(): - data.append((page['title'], page)) + data.append((page['title'], page['content'])) title = 'Activity' @@ -723,18 +723,16 @@ def get_realm_activity(request, realm): user_records, content = realm_user_summary_table(all_records) all_user_records.update(user_records) - user_content = dict(content=content) - - data += [(page_title, user_content)] + data += [(page_title, content)] page_title = 'Clients' content = realm_client_table(all_user_records) - data += [(page_title, dict(content=content))] + data += [(page_title, content)] page_title = 'History' content = sent_messages_report(realm) - data += [(page_title, dict(content=content))] + data += [(page_title, content)] title = realm return render_to_response( @@ -751,12 +749,10 @@ def get_user_activity(request, email): user_summary = get_user_activity_summary(records) content = user_activity_summary_table(user_summary) - user_content = dict(content=content) - data += [('Summary', user_content)] + data += [('Summary', content)] content = raw_user_activity_table(records) - user_content = dict(content=content) - data += [('Info', user_content)] + data += [('Info', content)] realm = None title = email diff --git a/templates/analytics/activity.html b/templates/analytics/activity.html index 002d7c29c6..0f8d9fa283 100644 --- a/templates/analytics/activity.html +++ b/templates/analytics/activity.html @@ -39,7 +39,7 @@ {% for name, activity in data %}
- {{ activity.content }} + {{ activity }}
{% endfor %}