Module: check_mk
Branch: master
Commit: dabe19a943f918528af5e310e5618def3d1a4145
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dabe19a943f918…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 5 12:00:12 2012 +0200
ValueSpec TextAscii: allow right alignment
---
web/htdocs/valuespec.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index f05add8..76630d4 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -182,6 +182,7 @@ class Integer(ValueSpec):
self._unit = kwargs.get("unit", "")
self._thousand_sep = kwargs.get("thousand_sep")
self._display_format = kwargs.get("display_format", "%d")
+ self._align = kwargs.get("align", "left")
if "size" not in kwargs and "maxvalue" in kwargs:
self._size = 1 + int(math.log10(self._maxvalue)) + \
@@ -197,7 +198,11 @@ class Integer(ValueSpec):
if self._label:
html.write(self._label)
html.write(" ")
- html.number_input(varprefix, str(value), size = self._size)
+ if self._align == "right":
+ style = "text-align: right;"
+ else:
+ style = ""
+ html.number_input(varprefix, str(value), size = self._size, style = style)
if self._unit:
html.write(" ")
html.write(self._unit)