@@ -251,6 +251,8 @@ issueList.IssueView = Backbone.View.extend({
251
251
events : {
252
252
'click .js-issue-label' : 'labelSearch' ,
253
253
} ,
254
+ _isLoggedIn : $ ( 'body' ) . data ( 'username' ) ,
255
+ _pageLimit : null ,
254
256
initialize : function ( ) {
255
257
this . issues = new issueList . IssueCollection ( ) ;
256
258
// check to see if we should pre-filter results
@@ -301,16 +303,14 @@ issueList.IssueView = Backbone.View.extend({
301
303
} ) ;
302
304
} ,
303
305
getPageLimit : function ( ) {
304
- // slice 5 to get to the N of "Show N"
305
- return { 'per_page' : $ ( '.js-dropdown-pagination .js-dropdown-toggle' ) . text ( ) . trim ( ) . slice ( 5 ) } ;
306
+ return this . _pageLimit ;
306
307
} ,
307
308
render : function ( issues ) {
308
309
this . $el . html ( this . template ( {
309
310
issues : issues . toJSON ( )
310
311
} ) ) ;
311
312
return this ;
312
313
} ,
313
- _isLoggedIn : $ ( 'body' ) . data ( 'username' ) ,
314
314
initPaginationLinks : function ( issues ) {
315
315
// if either the next or previous page numbers are null
316
316
// disable the buttons and add .is-disabled classes.
@@ -403,6 +403,10 @@ issueList.IssueView = Backbone.View.extend({
403
403
// $.extend will update existing object keys, and add new ones
404
404
var newParams = $ . extend ( $ . deparam ( modelParams ) , updateParams ) ;
405
405
406
+ if ( paramKey == 'per_page' ) {
407
+ this . _pageLimit = paramValue ;
408
+ }
409
+
406
410
// construct new model URL and re-request issues
407
411
this . issues . url = modelPath + '?' + $ . param ( newParams ) ;
408
412
this . fetchAndRenderIssues ( ) ;
0 commit comments