From 1b9670fce26b31e83b2236622fcb9b5b31a5ce4a Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Tue, 20 Aug 2013 18:05:25 +0400 Subject: [PATCH] Improved links to users and companies Change-Id: I4f5c821df2b50ed5728afcc5b605f9672cff09f5 --- dashboard/templates/overview.html | 8 ++++---- dashboard/web.py | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dashboard/templates/overview.html b/dashboard/templates/overview.html index 75f248a20..da31991f1 100644 --- a/dashboard/templates/overview.html +++ b/dashboard/templates/overview.html @@ -4,11 +4,11 @@ {% set show_engineer_breakdown = ((company) or (module)) and (not user_id) %} {% set show_module_breakdown = (not module) %} {% set show_user_activity = (user_id) %} -{% set show_module_activity = (module) %} +{% set show_module_activity = (module) and (not user_id) %} {% set show_activity = (show_user_activity) or (show_module_activity) %} -{% set show_user_contribution = show_user_activity %} -{% set show_module_contribution = show_module_activity %} -{% set show_contribution = show_activity %} +{% set show_user_contribution = (user_id) %} +{% set show_module_contribution = (module) and (not user_id) %} +{% set show_contribution = (show_user_contribution) or (show_module_contribution) %} {% set show_user_profile = (user_id) %} {% block scripts %} diff --git a/dashboard/web.py b/dashboard/web.py index c548db475..257e61a3e 100644 --- a/dashboard/web.py +++ b/dashboard/web.py @@ -563,10 +563,11 @@ def get_engineers(records, metric_filter, finalize_handler): def extend_record(record): record['date_str'] = format_datetime(record['date']) record['author_link'] = make_link( - record['author_name'], '/', {'user_id': record['user_id']}) + record['author_name'], '/', + {'user_id': record['user_id'], 'company': ''}) record['company_link'] = make_link( record['company_name'], '/', - {'company': record['company_name']}) + {'company': record['company_name'], 'user_id': ''}) record['gravatar'] = gravatar(record['author_email']) @@ -596,7 +597,9 @@ def get_activity_json(records): review['subject'] = parent['subject'] review['url'] = parent['url'] review['parent_author_link'] = make_link( - parent['author_name'], '/', {'user_id': parent['user_id']}) + parent['author_name'], '/', + {'user_id': parent['user_id'], + 'company': ''}) extend_record(review) result.append(review) @@ -694,7 +697,7 @@ def get_user(user_id): if user['companies']: company_name = user['companies'][-1]['company_name'] user['company_link'] = make_link( - company_name, '/', {'company': company_name}) + company_name, '/', {'company': company_name, 'user_id': ''}) else: user['company_link'] = '' user['gravatar'] = gravatar(user['emails'][0])