From aecab933b0ea152bcf590073bfb8cbf5619d5688 Mon Sep 17 00:00:00 2001 From: Montana Date: Mon, 11 Feb 2019 10:40:33 -0500 Subject: [PATCH 1/9] Add jinja filters for just dollars and just cents --- atst/filters.py | 9 +++++++++ templates/portfolios/header.html | 22 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/atst/filters.py b/atst/filters.py index 61c42f8c..f752c1b2 100644 --- a/atst/filters.py +++ b/atst/filters.py @@ -18,6 +18,13 @@ def dollars(value): numberValue = 0 return "${:,.2f}".format(numberValue) +def justDollars(value): + raw = dollars(value) + return raw[:-3] + +def justCents(value): + raw = dollars(value) + return raw[-3:] def usPhone(number): phone = re.sub(r"\D", "", number) @@ -99,6 +106,8 @@ def normalizeOrder(title): def register_filters(app): app.jinja_env.filters["iconSvg"] = iconSvg app.jinja_env.filters["dollars"] = dollars + app.jinja_env.filters["justDollars"] = justDollars + app.jinja_env.filters["justCents"] = justCents app.jinja_env.filters["usPhone"] = usPhone app.jinja_env.filters["readableInteger"] = readableInteger app.jinja_env.filters["getOptionLabel"] = getOptionLabel diff --git a/templates/portfolios/header.html b/templates/portfolios/header.html index 1895ecac..63b1a546 100644 --- a/templates/portfolios/header.html +++ b/templates/portfolios/header.html @@ -20,9 +20,29 @@ {{ Icon('info') }} - {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | dollars }} + {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }} + + + {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }} +
+ {% if funding_end_date and funded %} + {{ Icon('ok') }} + Funded through + + + {% elif funding_end_date and not funded %} + {{ Icon('alert') }} + Funded period ends + + + {% endif %} +
From be44d5f8db17f06de47c7e47c5ab879059c45acb Mon Sep 17 00:00:00 2001 From: Montana Date: Tue, 12 Feb 2019 09:37:10 -0500 Subject: [PATCH 3/9] Styling --- styles/components/_portfolio_layout.scss | 10 ++++ templates/portfolios/header.html | 59 +++++++++++++----------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/styles/components/_portfolio_layout.scss b/styles/components/_portfolio_layout.scss index 3def404f..434ce066 100644 --- a/styles/components/_portfolio_layout.scss +++ b/styles/components/_portfolio_layout.scss @@ -90,9 +90,19 @@ } } + .column-left { + width: 12.5rem; + float: left; + } + + .column-right { + margin-left: -.4rem; + } + .cents { font-size: 2rem; margin-top: .75rem; + margin-left: -.7rem; font-weight: bold; } diff --git a/templates/portfolios/header.html b/templates/portfolios/header.html index fe8ced23..8b22c289 100644 --- a/templates/portfolios/header.html +++ b/templates/portfolios/header.html @@ -15,33 +15,40 @@ {{ secondary_breadcrumb or portfolio.name }}
- Available budget - - - {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }} - - - {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }} - +
+ Available budget + +
+
+ + {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justDollars }} + + + {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | justCents }} + +
-
- {% if funding_end_date and funded %} - {{ Icon('ok') }} - Funded through - - - {% elif funding_end_date and not funded %} - {{ Icon('alert') }} - Funded period ends - - - {% endif %} +
+
+
+ {% if funding_end_date and funded %} + {{ Icon('ok') }} + Funded through + + + {% elif funding_end_date and not funded %} + {{ Icon('alert') }} + Funded period ends + + + {% endif %} +
From 0f1571a21403090c315214b40b28af571a6ca5e2 Mon Sep 17 00:00:00 2001 From: Montana Date: Tue, 12 Feb 2019 13:38:59 -0500 Subject: [PATCH 8/9] Removed unused import --- atst/routes/portfolios/task_orders.py | 1 - 1 file changed, 1 deletion(-) diff --git a/atst/routes/portfolios/task_orders.py b/atst/routes/portfolios/task_orders.py index 69c8768e..eba80695 100644 --- a/atst/routes/portfolios/task_orders.py +++ b/atst/routes/portfolios/task_orders.py @@ -1,5 +1,4 @@ from collections import defaultdict -from operator import itemgetter from flask import g, redirect, render_template, url_for, request as http_request From 4025974b926007dae3b31b2a40dc4de537e3a0fd Mon Sep 17 00:00:00 2001 From: Montana Date: Tue, 12 Feb 2019 13:40:31 -0500 Subject: [PATCH 9/9] Fix misaligned CSS --- styles/components/_portfolio_layout.scss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/styles/components/_portfolio_layout.scss b/styles/components/_portfolio_layout.scss index 9ee68a7c..265063c7 100644 --- a/styles/components/_portfolio_layout.scss +++ b/styles/components/_portfolio_layout.scss @@ -121,10 +121,9 @@ .unfunded { color: $color-red; - .icon { - @include icon-color($color-red); - } + @include icon-color($color-red); + } } }