From e90c507073eb9f3bc6b0eb61296ec173b5a7b1c1 Mon Sep 17 00:00:00 2001 From: Scott Torborg Date: Tue, 3 Nov 2009 16:52:08 -1000 Subject: [PATCH] cleaned up some issues with validation errors being displayed improperly --- bluechips/lib/helpers.py | 7 +++++++ bluechips/public/css/main.css | 10 ++++++++++ bluechips/public/icons/currency-small.png | Bin 0 -> 222 bytes bluechips/templates/spend/index.mako | 13 +++++++------ bluechips/templates/transfer/index.mako | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 bluechips/public/icons/currency-small.png diff --git a/bluechips/lib/helpers.py b/bluechips/lib/helpers.py index 1b8771b..40c2251 100644 --- a/bluechips/lib/helpers.py +++ b/bluechips/lib/helpers.py @@ -14,4 +14,11 @@ from decimal import Decimal def bluechips(): return 'BlueChips' +def currency(name, value, *args, **kwargs): + if 'class_' not in kwargs: + kwargs['class_'] = '' + kwargs['class_'] += 'currency' + value = "%0.2f" % (int(value) / 100.) + return text(name, value, *args, **kwargs) + flash = _Flash() diff --git a/bluechips/public/css/main.css b/bluechips/public/css/main.css index a63eb32..35d5c1a 100644 --- a/bluechips/public/css/main.css +++ b/bluechips/public/css/main.css @@ -94,3 +94,13 @@ div.flash { div.flash ul { margin-bottom: 0; } +span.error-message { + font-weight: bold; + color: #f00; +} +input.currency { + padding-left: 10px; + background-image: url(/icons/currency-small.png); + background-repeat: no-repeat; + background-position: center left; +} diff --git a/bluechips/public/icons/currency-small.png b/bluechips/public/icons/currency-small.png new file mode 100644 index 0000000000000000000000000000000000000000..81ae0a610ab80d3358524902d453e85a153ae961 GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^96-#&!3-ob9C+3PDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MY;h#A+G=b{|7S5%gc?8ja^(^&YU^(?%lhYGiM443a(nU zN=ZqnqoX4&Ep7Mi-JzkO&OArA09Cttx;TbZ+%oBj7CK`bU?S%I~qCutQ*<%IQnXuO@y;d%d24nZfWL!{=iq ScfJ9QWbkzLb6Mw<&;$T{N>Hu< literal 0 HcmV?d00001 diff --git a/bluechips/templates/spend/index.mako b/bluechips/templates/spend/index.mako index e3195f2..6198b0f 100644 --- a/bluechips/templates/spend/index.mako +++ b/bluechips/templates/spend/index.mako @@ -12,7 +12,7 @@ - $${h.text('amount', "%0.2f" % (int(c.expenditure.amount) / 100.), size=8)} + ${h.currency('amount', c.expenditure.amount, size=8)} @@ -27,10 +27,11 @@

Change how an expenditure is split up. Enter a percentage, or something like a percentage, for each user. They don't have to add to 100.

- % for user_id, user in c.users: + % for ii, user_row in enumerate(c.users): <% + user_id, user = user_row try: - percent = c.values['shares-%d.amount' % user_id] + percent = c.values['shares-%d.amount' % ii] except TypeError: if c.id != '': try: @@ -46,11 +47,11 @@ %> % endfor diff --git a/bluechips/templates/transfer/index.mako b/bluechips/templates/transfer/index.mako index 144cf91..736c339 100644 --- a/bluechips/templates/transfer/index.mako +++ b/bluechips/templates/transfer/index.mako @@ -12,7 +12,7 @@ - + -- 2.45.2
- + - ${h.text('shares-%d.amount' % user_id, percent)} - ${h.hidden('shares-%d.user_id' % user_id, user.id)} + ${h.text('shares-%d.amount' % ii, percent)} + ${h.hidden('shares-%d.user_id' % ii, user.id)}
$${h.text('amount', "%0.2f" % (int(c.transfer.amount) / 100.0), size=8)}${h.currency('amount', c.transfer.amount, size=8)}