summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/css/style.css5
-rw-r--r--static/js/show.js18
-rw-r--r--templates/pages/show.mako50
3 files changed, 45 insertions, 28 deletions
diff --git a/static/css/style.css b/static/css/style.css
index 26973a7..81a563a 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -71,6 +71,11 @@ img.right {
margin-left: 15px;
}
+div.detail > .heading {
+ font-weight: bold;
+}
+
+
/* Header */
#header {
diff --git a/static/js/show.js b/static/js/show.js
index 0c2fd8a..2c43015 100644
--- a/static/js/show.js
+++ b/static/js/show.js
@@ -1,7 +1,17 @@
$(document).ready(function(){
- $(".details_heading").click(function() {
- $(this).next().next().toggle()
- })
+ $(".detail > .heading").click(function() {
+ $(this).prevAll(".mark:last").click();
+ });
- $(".details").hide()
+ $(".detail > .mark").toggle(
+ function() {
+ this.src = this.src.replace("closed", "open");
+ $(this).nextAll(".details:first").toggle();
+ },
+ function() {
+ this.src = this.src.replace("open", "closed");
+ $(this).nextAll(".details:first").toggle();
+ });
+
+ $(".details").hide();
})
diff --git a/templates/pages/show.mako b/templates/pages/show.mako
index dc23b9c..054c287 100644
--- a/templates/pages/show.mako
+++ b/templates/pages/show.mako
@@ -5,31 +5,18 @@
<h2>${get_d(e)}</h2>
% endif
% for c in e.catexps:
- <strong class="details_heading">${c.cat.name}</strong> ${c.expense}<br/>
- <div class="details">
- <ul>
- % for exp in c.all:
- <li><a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</a></li>
- % endfor
- </ul>
- </div>
+ <%self:detail name="${c.cat.name}" sum="${c.expense}" set="${c.all}" args="exp">
+ <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</a>
+ </%self:detail>
% endfor
- <strong class="details_heading">Constant:</strong> ${e.constsum}<br/>
- <div class="details">
- <ul>
- % for c in e.consts:
- <li>${c.monthly} -- ${c.description}</li>
- % endfor
- </ul>
- </div>
- <strong class="details_heading">In Summa:</strong> ${e.sum}<br />
- <div class="details">
- <ul>
- % for exp in e.all:
- <li><a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</a></li>
- % endfor
- </ul>
- </div>
+
+ <%self:detail name="Constant" sum="${e.constsum}" set="${e.consts}" args="exp">
+ ${exp.monthly} -- ${exp.description}
+ </%self:detail>
+
+ <%self:detail name="In Summa" sum="${e.sum}" set="${e.all}" args="exp">
+ <a href=${"/edit/%s" % exp.id | url}>${exp.day}.${exp.month}. -- ${exp.description}: ${exp.expense}</a>
+ </%self:detail>
<br/>
% endfor
@@ -50,3 +37,18 @@
${parent.js()}
<script type="text/javascript" src=${"/static/js/show.js" | url}></script>
</%def>
+
+<%def name="detail(name, sum, set)">
+ <div class="detail">
+ <img class="mark" src=${"/static/images/closed.png" | url} />
+ <span class="heading">${name}:</span> <span class="sum">${sum}</span><br/>
+ <div class="details">
+ <ul>
+ % for exp in set:
+ <li class="expense">${caller.body(exp)}</li>
+ % endfor
+ </ul>
+ </div>
+ </div>
+</%def>
+