diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/guix-packages.js | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/js/guix-packages.js b/js/guix-packages.js index 7ab30a0..c9a61ca 100644 --- a/js/guix-packages.js +++ b/js/guix-packages.js @@ -52,37 +52,37 @@ guix.controller = function() { this.packages.then(function(packages) { self.pages(guix.paginate(packages, self.pageSize)); }); +}; - this.currentPage = function() { - return self.pages()[self.currentPageIndex] || []; - }; +guix.controller.prototype.currentPage = function() { + return this.pages()[this.currentPageIndex] || []; +}; - this.isFirstPage = function() { - return self.currentPageIndex === 0; - }; +guix.controller.prototype.isFirstPage = function() { + return this.currentPageIndex === 0; +}; - this.isLastPage = function() { - return self.currentPageIndex === self.pages().length - 1; - }; +guix.controller.prototype.isLastPage = function() { + return this.currentPageIndex === this.pages().length - 1; +}; - this.isCurrentPage = function(i) { - return self.currentPageIndex === i; - }; +guix.controller.prototype.isCurrentPage = function(i) { + return this.currentPageIndex === i; +}; - this.packageCount = function() { - return self.pages().reduce(function(memo, page) { - return memo + page.length; - }, 0); - }; +guix.controller.prototype.packageCount = function() { + return this.pages().reduce(function(memo, page) { + return memo + page.length; + }, 0); +}; - this.doSearch = function() { - var regexp = new RegExp(this.searchTerm(), "i"); +guix.controller.prototype.doSearch = function() { + var regexp = new RegExp(this.searchTerm(), "i"); - this.pages(guix.paginate(this.packages().filter(function(package) { - return regexp.test(package.name) || - regexp.test(package.synopsis); - }), self.pageSize)); - }; + this.pages(guix.paginate(this.packages().filter(function(package) { + return regexp.test(package.name) || + regexp.test(package.synopsis); + }), this.pageSize)); }; guix.view = function(ctrl) { |