summaryrefslogtreecommitdiff
path: root/js/view
diff options
context:
space:
mode:
Diffstat (limited to 'js/view')
-rw-r--r--js/view/packages.js26
1 files changed, 12 insertions, 14 deletions
diff --git a/js/view/packages.js b/js/view/packages.js
index e202471..7c55486 100644
--- a/js/view/packages.js
+++ b/js/view/packages.js
@@ -15,7 +15,8 @@
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>.
-(function(packages) {
+(function() {
+ var packages = guix.packages;
var spinner = m(".spinner-container", m(".spinner"));
packages.view = function(ctrl) {
@@ -75,7 +76,7 @@
])
]),
m("tbody", [
- ctrl.currentPage().map(function(package) {
+ ctrl.pager().currentPage().map(function(package) {
return m("tr", [
m("td", renderName(package)),
m("td", package.version),
@@ -100,30 +101,27 @@
return m("div", m("ul.pagination", [
// Back page
renderPage("«", {
- class: ctrl.isFirstPage() ? "disabled" : "",
+ class: ctrl.pager().isFirstPage() ? "disabled" : "",
onclick: function() {
- ctrl.currentPageIndex--;
-
+ ctrl.pager().previousPage();
return false;
}
})
- ].concat(ctrl.pages().map(function(page, i) {
+ ].concat(ctrl.pager().pages.map(function(page, i) {
// Jump to page
return renderPage(i + 1, {
- class: ctrl.isCurrentPage(i) ? "active" : "",
+ class: ctrl.pager().isCurrentPage(i) ? "active" : "",
onclick: function() {
- ctrl.currentPageIndex = i;
-
+ ctrl.pager().gotoPage(i);
return false;
}
});
})).concat([
// Forward page
renderPage("»", {
- class: ctrl.isLastPage() ? "disabled" : "",
+ class: ctrl.pager().isLastPage() ? "disabled" : "",
onclick: function() {
- ctrl.currentPageIndex++;
-
+ ctrl.pager().nextPage();
return false;
}
})
@@ -239,7 +237,7 @@
return null;
}
- return guix.withLayout(_.isEmpty(ctrl.pages()) ? spinner : [
+ return guix.withLayout(ctrl.pager().isEmpty() ? spinner : [
m("h2", [
"Packages",
m("span.badge", ctrl.packageCount())
@@ -250,4 +248,4 @@
renderPagination()
]);
};
-})(guix.packages);
+})();