diff options
-rw-r--r-- | js/controller/packages.js | 4 | ||||
-rw-r--r-- | js/model/packages.js | 2 | ||||
-rw-r--r-- | js/view/packages.js | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/js/controller/packages.js b/js/controller/packages.js index d9e0839..b1348e9 100644 --- a/js/controller/packages.js +++ b/js/controller/packages.js @@ -51,8 +51,10 @@ this.pager = m.prop(Pager([])); this.phase = m.prop(packages.PHASE_NONE); this.selectedPackage = m.prop(null); + this.packages = m.prop([]); - this.packages = packages.Packages() + packages.Packages() + .then(this.packages) .then(function(packages) { // All packages are visible initially self.pager(Pager(packages)); diff --git a/js/model/packages.js b/js/model/packages.js index 1c61d25..bea1280 100644 --- a/js/model/packages.js +++ b/js/model/packages.js @@ -55,7 +55,7 @@ } Pager.prototype.currentPage = function() { - return this.pages[this.pageIndex]; + return this.pages[this.pageIndex] || []; }; Pager.prototype.pageCount = function() { diff --git a/js/view/packages.js b/js/view/packages.js index c2cde74..77b9785 100644 --- a/js/view/packages.js +++ b/js/view/packages.js @@ -224,7 +224,7 @@ return null; } - return guix.withLayout(ctrl.pager().isEmpty() ? spinner : [ + return guix.withLayout(_.isEmpty(ctrl.packages()) ? spinner : [ guix.ui.headerWithBadge("Packages", ctrl.packageCount()), renderModal(), renderSearchBox(), |