Permalink
Browse files

add support for sorting repos in list (closes #16)

  • Loading branch information...
1 parent 51ae746 commit faa1af7f4317afe26d86a656288aef0c0720b9f3 @Vrtak-CZ Vrtak-CZ committed with Mar 24, 2012
@@ -42,6 +42,10 @@
section { padding-top: 30px; }
dl { margin-top: 0px; }
+ th.header { background-image: url(../img/bg.gif); cursor: pointer; font-weight: bold; background-repeat: no-repeat; background-position: center left; padding-left: 20px; border-right: 1px solid #dad9c7; margin-left: -1px; }
+ th.headerSortUp { background-image: url(../img/asc.gif); }
+ th.headerSortDown { background-image: url(../img/desc.gif); }
+
{block css}{/block}
</style>
{block head}{/block}
@@ -13,23 +13,35 @@
</div>
{if $repos}
+ <script src="{$basePath}/js/jquery.tablesorter.min.js"></script>
<script>
function filterRepos(text) {
$("#repos tbody tr").each(function () {
var tr = $(this);
-
+
if (text === '') {
tr.show();
return;
}
-
+
if (tr.find('td:eq(0), td:eq(1)').text().toLowerCase().indexOf(text.toLowerCase()) !== -1) {
tr.show();
} else {
tr.hide();
}
});
}
+ $(function() {
+ $('#repos').tablesorter({
+ headers: {
+ 4: { sorter: false },
+ 5: { sorter: false },
+ },
+ textExtraction: function(el) {
+ return $(el).data('sorter') || el.textContent;
+ }
+ });
+ });
</script>
<form>
<p>Filter: <input type="text" id="filter" onkeyup="filterRepos(this.value)"></p>
@@ -54,8 +66,8 @@
<small><a n:tag-if="strpos($repo->url, 'github.com') !== false" href="https://github.com/{$repo->dir}">{$repo->dir}</a>
<a n:if="$repo->branch" class="label label-info" title="Branch" href="https://github.com/{$repo->dir}/tree/{$repo->branch}">{$repo->branch}</a>
</td>
- <td>{!$repo->lastPull|timeAgoInWordsEx}</td>
- <td>{!$repo->lastGenerated|timeAgoInWordsEx}</td>
+ <td data-sorter="-{$repo->lastPull|date:'U'}">{!$repo->lastPull|timeAgoInWordsEx}</td>
+ <td data-sorter="-{$repo->lastGenerated|date:'U'}">{!$repo->lastGenerated|timeAgoInWordsEx}</td>
<td n:class="status, $repo->error ? error">
{if !$repo->error && !$repo->lastGenerated}
being generated right now...
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit faa1af7

Please sign in to comment.