@@ -300,6 +300,10 @@ issueList.IssueView = Backbone.View.extend({
300
300
wcEvents . trigger ( 'flash:error' , { message : message , timeout : timeout } ) ;
301
301
} ) ;
302
302
} ,
303
+ 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
+ } ,
303
307
render : function ( issues ) {
304
308
this . $el . html ( this . template ( {
305
309
issues : issues . toJSON ( )
@@ -371,16 +375,21 @@ issueList.IssueView = Backbone.View.extend({
371
375
// update the collection instance url property and fetch the issues.
372
376
var labelCategories = [ 'closed' , 'contactready' , 'needsdiagnosis' , 'sitewait' ] ;
373
377
378
+ //TODO(miket): make generic getModelParams method which can get the latest state
379
+ var paramsBag = $ . extend ( { page : 1 } , this . getPageLimit ( ) ) ;
380
+ var params = $ . param ( paramsBag ) ;
381
+
374
382
// note: if query is the empty string, it will load all issues from the
375
383
// '/api/issues' endpoint (which I think we want).
376
384
if ( category && category . query ) {
377
- this . issues . url = '/api/issues/search?q=' + category . query + '&page=1' ;
385
+ params = $ . param ( $ . extend ( paramsBag , { q : category . query } ) ) ;
386
+ this . issues . url = '/api/issues/search?' + params ;
378
387
} else if ( _ . contains ( labelCategories , category ) ) {
379
- this . issues . url = '/api/issues/category/' + category + '?page=1' ;
388
+ this . issues . url = '/api/issues/category/' + category + '?' + params ;
380
389
} else if ( category === "untriaged" ) {
381
- this . issues . url = '/api/issues/search/untriaged?page=1' ;
390
+ this . issues . url = '/api/issues/search/untriaged?' + params ;
382
391
} else {
383
- this . issues . url = '/api/issues?page=1' ;
392
+ this . issues . url = '/api/issues?' + params ;
384
393
}
385
394
this . fetchAndRenderIssues ( ) ;
386
395
} ,
0 commit comments