From ad271d4d29411e81c94fac97d6f66cc5caf18316 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Thu, 31 Oct 2013 16:35:04 +0400 Subject: [PATCH] Activity log code is polished + Removed activity log macro (unused) + Added Icehouse tags for glance into test data Change-Id: I56de44684e234e9b212da4a69ab47b53511ca5ca --- dashboard/helpers.py | 17 ++-- dashboard/templates/_macros/activity_log.html | 27 +++--- dashboard/templates/reports/base_report.html | 89 ------------------- .../templates/reports/blueprint_summary.html | 2 +- .../templates/reports/company_activity.html | 2 +- .../templates/reports/user_activity.html | 2 +- dashboard/web.py | 4 +- etc/test_default_data.json | 6 ++ 8 files changed, 38 insertions(+), 111 deletions(-) diff --git a/dashboard/helpers.py b/dashboard/helpers.py index 7fe218e3a..2623f817d 100644 --- a/dashboard/helpers.py +++ b/dashboard/helpers.py @@ -58,23 +58,28 @@ def extend_record(record): if not parent: return None + parent = parent.copy() + _extend_record_common_fields(parent) for k, v in parent.iteritems(): record['parent_%s' % k] = v + record['review_number'] = parent.get('review_number') record['subject'] = parent['subject'] record['url'] = parent['url'] - record['parent_author_link'] = make_link( - parent['author_name'], '/', - {'user_id': parent['user_id'], 'company': ''}) elif record['record_type'] == 'email': record['email_link'] = record.get('email_link') or '' + record['blueprint_links'] = [] + for bp_id in record.get('blueprint_id', []): + bp_module, bp_name = bp_id.split(':') + record['blueprint_links'].append( + make_blueprint_link(bp_module, bp_name)) elif record['record_type'] in ['bpd', 'bpc']: record['summary'] = utils.format_text(record['summary']) if record.get('mention_count'): record['mention_date_str'] = format_datetime( record['mention_date']) - record['blueprint_link'] = make_blueprint_link( - record['name'], record['module']) + record['blueprint_link'] = make_blueprint_link(record['module'], + record['name']) return record @@ -179,7 +184,7 @@ def make_link(title, uri=None, options=None): return '%(title)s' % {'uri': uri, 'title': title} -def make_blueprint_link(name, module): +def make_blueprint_link(module, name): uri = '/report/blueprint/' + module + '/' + name return '%(title)s' % {'uri': uri, 'title': name} diff --git a/dashboard/templates/_macros/activity_log.html b/dashboard/templates/_macros/activity_log.html index 1435cc7a6..12576ddd7 100644 --- a/dashboard/templates/_macros/activity_log.html +++ b/dashboard/templates/_macros/activity_log.html @@ -1,4 +1,4 @@ -{% macro show_activity_log(user_id=None, company=None, blueprint_id=None, show_gravatar=True, gravatar_size=32) -%} +{% macro show_activity_log(user_id=None, company=None, blueprint_id=None, show_record_type=True, show_user_gravatar=True, gravatar_size=32) -%}