diff options
author | Dan McGee <dan@archlinux.org> | 2010-09-08 09:57:34 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-09-08 09:57:34 -0500 |
commit | 5ea7b4c732818ae7b469abc597fa4da6161c4781 (patch) | |
tree | a29b2070e1e7d02e073dc68d32375b7324c2e5a8 | |
parent | 5062870c1b88c7cd61d8521a94e80530e4d1f0aa (diff) |
Developer dashboard fixes
As reported by Thomas, the dashboard JS dies when we try to apply table
sorting to a table with no entries (those in the top section). Use some
selector magic to only apply tablesorting if the table actually has rows
worth sorting.
Also move the package todo lists table down in the dashboard as the other
two tables are more relevant for the individual developer.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | templates/devel/index.html | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/templates/devel/index.html b/templates/devel/index.html index ee0a97d7..eccfbe3d 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -6,30 +6,6 @@ <h2>Developer Dashboard</h2> - {% if todos %} - <h3>Package Todo Lists</h3> - - <table id="dash-todo" class="results dash-stats"> - <thead> - <tr> - <th>Name</th> - <th>Creation Date</th> - <th>Description</th> - </tr> - </thead> - <tbody> - {% for todo in todos %} - <tr class="{% cycle 'odd' 'even' %}"> - <td class="key"><a href="{{ todo.get_absolute_url }}" - title="View todo list: {{ todo.name }}">{{ todo.name }}</a></td> - <td>{{ todo.date_added }}</td> - <td>{{ todo.description|safe }}</td> - </tr> - {% endfor %} - </tbody> - </table> - {% endif %} - <h3>My Flagged Packages</h3> <table id="dash-myflagged" class="results dash-stats"> @@ -51,7 +27,7 @@ <td>{{ pkg.arch.name }}</td> </tr> {% empty %} - <tr><td colspan="4"><em>No flagged packages to display</em></td></tr> + <tr class="empty"><td colspan="4"><em>No flagged packages to display</em></td></tr> {% endfor %} </tbody> </table> @@ -80,7 +56,31 @@ <td>{{ todopkg.pkg.maintainers|join:', ' }}</td> </tr> {% empty %} - <tr><td colspan="4"><em>No incomplete todo list packages to display</em></td></tr> + <tr class="empty"><td colspan="5"><em>No incomplete todo list packages to display</em></td></tr> + {% endfor %} + </tbody> + </table> + + <h3>Package Todo Lists</h3> + + <table id="dash-todo" class="results dash-stats"> + <thead> + <tr> + <th>Name</th> + <th>Creation Date</th> + <th>Description</th> + </tr> + </thead> + <tbody> + {% for todo in todos %} + <tr class="{% cycle 'odd' 'even' %}"> + <td class="key"><a href="{{ todo.get_absolute_url }}" + title="View todo list: {{ todo.name }}">{{ todo.name }}</a></td> + <td>{{ todo.date_added }}</td> + <td>{{ todo.description|safe }}</td> + </tr> + {% empty %} + <tr class="empty"><td colspan="3"><em>No package todo lists to display</em></td></tr> {% endfor %} </tbody> </table> @@ -201,12 +201,21 @@ $.tablesorter.addParser({ type: 'numeric' }); $(document).ready(function() { - $("#dash-todo").tablesorter({widgets: ['zebra'], sortList: [[1,1]]}); - $("#dash-myflagged").tablesorter({widgets: ['zebra'], sortList: [[0,0]]}); - $("#dash-mytodolist").tablesorter({widgets: ['zebra'], sortList: [[0,0], [1,0]]}); - $("#stats-by-arch").tablesorter({widgets: ['zebra'], sortList: [[0,0]], headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); - $("#stats-by-repo").tablesorter({widgets: ['zebra'], sortList: [[0,0]], headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); - $("#stats-by-maintainer").tablesorter({widgets: ['zebra'], sortList: [[0,0]], headers: { 1: { sorter: 'pkgcount' } } }); + $("#dash-myflagged:not(:has(tbody tr.empty))").tablesorter( + {widgets: ['zebra'], sortList: [[0,0]]}); + $("#dash-mytodolist:not(:has(tbody tr.empty))").tablesorter( + {widgets: ['zebra'], sortList: [[0,0], [1,0]]}); + $("#dash-todo:not(:has(tbody tr.empty))").tablesorter( + {widgets: ['zebra'], sortList: [[1,1]]}); + $("#stats-by-arch").tablesorter( + {widgets: ['zebra'], sortList: [[0,0]], + headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); + $("#stats-by-repo").tablesorter( + {widgets: ['zebra'], sortList: [[0,0]], + headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); + $("#stats-by-maintainer").tablesorter( + {widgets: ['zebra'], sortList: [[0,0]], + headers: { 1: { sorter: 'pkgcount' } } }); $("h3.dash-stats").click( function(e) { $(this).next().toggle(); } ); |