Anand Doshi | 6c8ef77 | 2013-08-30 18:23:50 +0530 | [diff] [blame] | 1 | {% extends "app/website/templates/html/page.html" %} |
| 2 | |
| 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 -%} |
| 22 | $(document).ready(function() { |
| 23 | window.start = 0; |
| 24 | window.$list = $(".transaction-list"); |
| 25 | window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); }) |
| 26 | |
| 27 | get_transactions(); |
| 28 | }); |
| 29 | |
| 30 | var get_transactions = function(btn) { |
| 31 | wn.call({ |
| 32 | method: "{{ method }}", |
| 33 | args: { start: start }, |
| 34 | btn: btn, |
| 35 | callback: function(r) { |
| 36 | $list.find(".progress").remove(); |
| 37 | $show_more.toggleClass("hide", !(r.message && r.message.length===20)); |
| 38 | |
| 39 | if(!(r.message && r.message.length)) { |
| 40 | console.log("empty"); |
| 41 | if(!$list.html().trim()) { |
| 42 | $list.html("<div class='alert alert-warning'>\ |
| 43 | {{ empty_list_message }}</div>"); |
| 44 | } |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | start += r.message.length; |
| 49 | |
| 50 | $.each(r.message, function(i, doc) { |
| 51 | render(doc); |
| 52 | }); |
| 53 | } |
| 54 | }) |
| 55 | }; |
| 56 | |
| 57 | // var render = function(doc) { }; |
| 58 | |
| 59 | {% endblock %} |