Skip to content

Commit a535516

Browse files
author
Mike Taylor
committed
Issue #372 - store "page_limit" key as view object property
1 parent db6346c commit a535516

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

webcompat/static/js/lib/issue-list.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ issueList.IssueView = Backbone.View.extend({
251251
events: {
252252
'click .js-issue-label': 'labelSearch',
253253
},
254+
_isLoggedIn: $('body').data('username'),
255+
_pageLimit: null,
254256
initialize: function() {
255257
this.issues = new issueList.IssueCollection();
256258
// check to see if we should pre-filter results
@@ -301,16 +303,14 @@ issueList.IssueView = Backbone.View.extend({
301303
});
302304
},
303305
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;
306307
},
307308
render: function(issues) {
308309
this.$el.html(this.template({
309310
issues: issues.toJSON()
310311
}));
311312
return this;
312313
},
313-
_isLoggedIn: $('body').data('username'),
314314
initPaginationLinks: function(issues) {
315315
// if either the next or previous page numbers are null
316316
// disable the buttons and add .is-disabled classes.
@@ -403,6 +403,10 @@ issueList.IssueView = Backbone.View.extend({
403403
// $.extend will update existing object keys, and add new ones
404404
var newParams = $.extend($.deparam(modelParams), updateParams);
405405

406+
if (paramKey == 'per_page') {
407+
this._pageLimit = paramValue;
408+
}
409+
406410
// construct new model URL and re-request issues
407411
this.issues.url = modelPath + '?' + $.param(newParams);
408412
this.fetchAndRenderIssues();

0 commit comments

Comments
 (0)