summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2012-01-10 22:33:20 +0100
committerRené 'Necoro' Neumann <necoro@necoro.net>2012-01-10 22:33:20 +0100
commit8de68a6a0d027a86205cab0c078230e9391496d5 (patch)
tree4ac0c5220f666746caeeff8cc8cf950b5f3040ea
parent9b5a3dce00b2c021362919c5509b38413baec133 (diff)
downloadkosten-8de68a6a0d027a86205cab0c078230e9391496d5.tar.gz
kosten-8de68a6a0d027a86205cab0c078230e9391496d5.tar.bz2
kosten-8de68a6a0d027a86205cab0c078230e9391496d5.zip
Added colorize function to templates
Diffstat (limited to '')
-rw-r--r--templates/page.mako12
-rw-r--r--templates/pages/show.mako8
2 files changed, 17 insertions, 3 deletions
diff --git a/templates/page.mako b/templates/page.mako
index e08207c..bc52c7f 100644
--- a/templates/page.mako
+++ b/templates/page.mako
@@ -23,3 +23,15 @@ ${next.body()}
</a>
</%def>
+<%def name="colorize(fgcolor=None, bgcolor=None, tag='span')">
+ % if fgcolor is None and bgcolor is None:
+ ${caller.body()}
+ % else:
+ <%
+ style = ""
+ if fgcolor is not None: style += " color: " + fgcolor
+ if bgcolor is not None: style += " background: "+ bgcolor
+ %>
+ <${tag} style="${style}">${caller.body()}</${tag}>
+ % endif
+</%def>
diff --git a/templates/pages/show.mako b/templates/pages/show.mako
index ed487cb..565a518 100644
--- a/templates/pages/show.mako
+++ b/templates/pages/show.mako
@@ -14,7 +14,7 @@
<a href=${"/const/%s" % exp.id | url}>${exp.monthly} -- ${exp.description}</a>
</%self:detail>
- <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp">
+ <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp" color="#ff2d2d">
<a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</a>
</%self:detail>
<br/>
@@ -55,10 +55,12 @@ ${self.left_arrow(date, date)}
<script type="text/javascript" src=${"/static/js/show.js" | url}></script>
</%def>
-<%def name="detail(name, sum, set)">
+<%def name="detail(name, sum, set, color=None)">
<div class="detail">
<img class="mark" src=${"/static/images/closed.png" | url} />
- <span class="heading">${name}:</span> <span class="sum">${sum}</span><br/>
+ <%self:colorize fgcolor="${color}">
+ <span class="heading">${name}:</span> <span class="sum">${sum}</span><br/>
+ </%self:colorize>
<div class="details">
<ul>
% for exp in set: