summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/controller/packages.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/js/controller/packages.js b/js/controller/packages.js
index b1348e9..9cac565 100644
--- a/js/controller/packages.js
+++ b/js/controller/packages.js
@@ -57,7 +57,7 @@
.then(this.packages)
.then(function(packages) {
// All packages are visible initially
- self.pager(Pager(packages));
+ self.sortAndPage(packages);
})
.then(m.redraw);
};
@@ -69,13 +69,18 @@
.value();
};
+ controller.prototype.sortAndPage = function(packages) {
+ this.pager(Pager(this.sorter().sort(packages)));
+ };
+
controller.prototype.doSearch = function() {
var regexp = new RegExp(this.searchTerm(), "i");
-
- this.pager(Pager(this.packages().filter(function(package) {
+ var filteredPackages = this.packages().filter(function(package) {
return regexp.test(package.name) ||
regexp.test(package.synopsis);
- })));
+ });
+
+ this.sortAndPage(filteredPackages);
};
controller.prototype.sortBy = function(field) {