blob: 23d5f812ea5960399e2d9261a10dd2bf58866679 [file] [log] [blame]
Anand Doshi330dae92013-09-10 13:46:15 +05301{% extends base_template %}
Anand Doshi6c8ef772013-08-30 18:23:50 +05302
3{% block content -%}
4<div class="col-md-12">
5 <ul class="breadcrumb">
6 <li><a href="index">Home</a></li>
7 <li><a href="account">My Account</a></li>
8 <li class="active"><i class="{{ icon }} icon-fixed-width"></i> {{ title }}</li>
9 </ul>
10 <div class="list-group transaction-list">
11 <div class="progress progress-striped active">
12 <div class="progress-bar progress-bar-info" style="width: 100%;"></div>
13 </div>
14 </div>
15 <div class="text-center">
16 <button class="btn btn-default btn-show-more hide">More</button>
17 </div>
18</div>
19{%- endblock %}
20
21{% block javascript -%}
Anand Doshi330dae92013-09-10 13:46:15 +053022<script>
Anand Doshi6c8ef772013-08-30 18:23:50 +053023$(document).ready(function() {
24 window.start = 0;
25 window.$list = $(".transaction-list");
26 window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); })
27
28 get_transactions();
29});
30
31var get_transactions = function(btn) {
32 wn.call({
33 method: "{{ method }}",
34 args: { start: start },
35 btn: btn,
36 callback: function(r) {
37 $list.find(".progress").remove();
38 $show_more.toggleClass("hide", !(r.message && r.message.length===20));
39
40 if(!(r.message && r.message.length)) {
41 console.log("empty");
42 if(!$list.html().trim()) {
43 $list.html("<div class='alert alert-warning'>\
44 {{ empty_list_message }}</div>");
45 }
46 return;
47 }
48
49 start += r.message.length;
50
51 $.each(r.message, function(i, doc) {
52 render(doc);
53 });
54 }
55 })
56};
Anand Doshi330dae92013-09-10 13:46:15 +053057</script>
Anand Doshi6c8ef772013-08-30 18:23:50 +053058
Anand Doshi330dae92013-09-10 13:46:15 +053059<!-- // var render = function(doc) { }; -->
Anand Doshi6c8ef772013-08-30 18:23:50 +053060{% endblock %}