summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/guix-packages.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/js/guix-packages.js b/js/guix-packages.js
index c9a61ca..3a3518a 100644
--- a/js/guix-packages.js
+++ b/js/guix-packages.js
@@ -31,10 +31,6 @@ guix.chunk = function(array, size) {
}, []);
};
-guix.paginate = function(array, pageSize) {
- return guix.chunk(array, pageSize);
-};
-
guix.Packages = function() {
return m.request({ method: "GET", url: "packages.json" });
};
@@ -50,10 +46,14 @@ guix.controller = function() {
// All packages are visible initially
this.packages.then(function(packages) {
- self.pages(guix.paginate(packages, self.pageSize));
+ self.pages(self.paginate(packages, self.pageSize));
});
};
+guix.controller.prototype.paginate = function(array, pageSize) {
+ return guix.chunk(this.sorter.sort(array), pageSize);
+};
+
guix.controller.prototype.currentPage = function() {
return this.pages()[this.currentPageIndex] || [];
};
@@ -79,7 +79,7 @@ guix.controller.prototype.packageCount = function() {
guix.controller.prototype.doSearch = function() {
var regexp = new RegExp(this.searchTerm(), "i");
- this.pages(guix.paginate(this.packages().filter(function(package) {
+ this.pages(this.paginate(this.packages().filter(function(package) {
return regexp.test(package.name) ||
regexp.test(package.synopsis);
}), this.pageSize));