Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 1 | {% extends 'base.html' %} |
| 2 | |
| 3 | {% block title %} All projects - Toaster {% endblock %} |
| 4 | |
| 5 | {% block pagecontent %} |
| 6 | |
| 7 | <div class="page-header top-air"> |
| 8 | <h1 data-role="page-title"></h1> |
| 9 | </div> |
| 10 | |
| 11 | {% url 'projects' as xhr_table_url %} |
| 12 | {% include 'toastertable.html' %} |
| 13 | |
| 14 | <script> |
| 15 | $(document).ready(function () { |
| 16 | var tableElt = $("#{{table_name}}"); |
| 17 | var titleElt = $("[data-role='page-title']"); |
| 18 | |
| 19 | tableElt.on("table-done", function (e, total, tableParams) { |
| 20 | var title = "All projects"; |
| 21 | |
| 22 | if (tableParams.search || tableParams.filter) { |
| 23 | if (total === 0) { |
| 24 | title = "No projects found"; |
| 25 | } |
| 26 | else if (total > 0) { |
| 27 | title = total + " project" + (total > 1 ? 's' : '') + " found"; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | titleElt.text(title); |
| 32 | }); |
| 33 | }); |
| 34 | </script> |
| 35 | |
| 36 | {% endblock %} |