aboutsummaryrefslogtreecommitdiffstats
path: root/tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'tmpl')
-rw-r--r--tmpl/index.html8
-rw-r--r--tmpl/index.json21
2 files changed, 29 insertions, 0 deletions
diff --git a/tmpl/index.html b/tmpl/index.html
index c4d71bd..2939fc4 100644
--- a/tmpl/index.html
+++ b/tmpl/index.html
@@ -165,6 +165,14 @@
<p><a href="donations.rss">Donations RSS Feed <img src="[% config.staticdir_url %]/feed-16x16.png" alt="RSS feed" /></a></p>
<p><a href="transactions.rss">Transactions RSS Feed <img src="[% config.staticdir_url %]/feed-16x16.png" alt="RSS feed" /></a></p>
+ <h2>JSON data</h2>
+
+ Some data is available in json format :
+ <ul>
+ <li><a href="index.json">index.json</a>: balance, donations received in
+ the last 30 days, and the list of the last 10 donations</li>
+ </ul>
+
<h2>Grisbi</h2>
<p>
Mageia.Org accounts are managed using <a href="http://grisbi.org/">grisbi</a>.
diff --git a/tmpl/index.json b/tmpl/index.json
new file mode 100644
index 0000000..1f60acf
--- /dev/null
+++ b/tmpl/index.json
@@ -0,0 +1,21 @@
+[%- USE JSON ( pretty => 1 ) -%]
+[%- USE date(format='%Y/%m/%d') -%]
+[%-
+ SET out = {};
+ SET out.balance = transactions.balance.bstr;
+ SET out.donations_30days = donations.total_30.bstr;
+ SET out.last_donations = [];
+ SET i=0;
+ SET l=10;
+ FOREACH don IN donations.donations.sort('date').reverse;
+ SET i = i + 1;
+ LAST IF i > l;
+ SET n = {};
+ SET n.pa = don.pa;
+ SET n.who = don.who;
+ SET n.amount = don.amount.bstr;
+ SET n.date = date.format(don.date);
+ out.last_donations.push(n);
+ END;
+-%]
+[% out.json -%]