[extensions-web] js: Fix paging



commit 92ef6501f5980ddbd158aad06cb9642c2032bb87
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Apr 1 09:35:16 2012 -0400

    js: Fix paging
    
    I forgot to re-attach the hashchange handler.

 sweettooth/static/js/paginator.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/static/js/paginator.js b/sweettooth/static/js/paginator.js
index c168d5d..42108a2 100644
--- a/sweettooth/static/js/paginator.js
+++ b/sweettooth/static/js/paginator.js
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates'], function($, hashParamUtils, paginatorUtils, dbusProxy, templates) {
+define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates', 'jquery.hashchange'], function($, hashParamUtils, paginatorUtils, dbusProxy, templates) {
     "use strict";
 
     $.fn.paginatorify = function(context) {
@@ -45,7 +45,7 @@ define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates'], fu
 
                 $loadingPageContent.detach();
 
-                var page = queryParams.page;
+                var page = parseInt(queryParams.page, 10);
                 var numPages = result.numpages;
 
                 var $paginator = paginatorUtils.buildPaginator(page, numPages, context);
@@ -70,6 +70,8 @@ define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates'], fu
             });
         }
 
+        $(window).hashchange(loadPage);
+
         this.bind('load-page', loadPage);
 
         return this;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]