Anand Doshi | 330dae9 | 2013-09-10 13:46:15 +0530 | [diff] [blame] | 1 | {% extends base_template %} |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 2 | |
| 3 | {% block content -%} |
Anand Doshi | 0c8fd34 | 2013-11-21 14:55:45 +0530 | [diff] [blame] | 4 | <div class="container content"> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 5 | <ul class="breadcrumb"> |
| 6 | <li><a href="index">Home</a></li> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 7 | <li class="active"><i class="{{ icon }} icon-fixed-width"></i> {{ title }}</li> |
| 8 | </ul> |
Anand Doshi | fb109ad | 2013-09-11 18:58:20 +0530 | [diff] [blame] | 9 | <p id="msgprint-alert" class="alert alert-danger" |
| 10 | style="display: none;"> </p> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 11 | <div class="list-group transaction-list"> |
| 12 | <div class="progress progress-striped active"> |
| 13 | <div class="progress-bar progress-bar-info" style="width: 100%;"></div> |
| 14 | </div> |
| 15 | </div> |
| 16 | <div class="text-center"> |
| 17 | <button class="btn btn-default btn-show-more hide">More</button> |
| 18 | </div> |
| 19 | </div> |
| 20 | {%- endblock %} |
| 21 | |
| 22 | {% block javascript -%} |
Anand Doshi | 330dae9 | 2013-09-10 13:46:15 +0530 | [diff] [blame] | 23 | <script> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 24 | $(document).ready(function() { |
| 25 | window.start = 0; |
| 26 | window.$list = $(".transaction-list"); |
| 27 | window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); }) |
| 28 | |
| 29 | get_transactions(); |
| 30 | }); |
| 31 | |
| 32 | var get_transactions = function(btn) { |
| 33 | wn.call({ |
| 34 | method: "{{ method }}", |
| 35 | args: { start: start }, |
| 36 | btn: btn, |
| 37 | callback: function(r) { |
| 38 | $list.find(".progress").remove(); |
| 39 | $show_more.toggleClass("hide", !(r.message && r.message.length===20)); |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 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 Doshi | 330dae9 | 2013-09-10 13:46:15 +0530 | [diff] [blame] | 57 | </script> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 58 | |
Anand Doshi | 330dae9 | 2013-09-10 13:46:15 +0530 | [diff] [blame] | 59 | <!-- // var render = function(doc) { }; --> |
Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 60 | {% endblock %} |