Skip to content

Instantly share code, notes, and snippets.

@miketaylr
Created July 11, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miketaylr/01b9f090dda8c6e928d40c7eb08081c5 to your computer and use it in GitHub Desktop.
Save miketaylr/01b9f090dda8c6e928d40c7eb08081c5 to your computer and use it in GitHub Desktop.
diff --git a/webcompat/static/js/lib/comments.js b/webcompat/static/js/lib/comments.js
index ba03c93..56eee1e 100644
--- a/webcompat/static/js/lib/comments.js
+++ b/webcompat/static/js/lib/comments.js
@@ -7,14 +7,14 @@ var issues = issues || {};
issues.CommentsCollection = Backbone.Collection.extend({
model: issues.Comment,
url: function() {
- return '/api/issues/' + issueNumber + '/comments?page=' + this.param;
+ return '/api/issues/' + issueNumber + '/comments?page=' + this.pageNumber;
},
- initialize: function(param) {
- this.param = param[0].page;
+ initialize: function(options) {
+ this.pageNumber = options.pageNumber;
},
- fetchPage: function(commentPage, options) {
- if (commentPage.page) {
- this.param = commentPage.page;
+ fetchPage: function(options) {
+ if (options.pageNumber) {
+ this.pageNumber = options.pageNumber;
}
return this.fetch(options);
}
diff --git a/webcompat/static/js/lib/issues.js b/webcompat/static/js/lib/issues.js
index 4a6ede4..a39010a 100644
--- a/webcompat/static/js/lib/issues.js
+++ b/webcompat/static/js/lib/issues.js
@@ -371,8 +371,7 @@ issues.MainView = Backbone.View.extend({
$(document.body).addClass('language-html');
var issueNum = {number: issueNumber};
this.issue = new issues.Issue(issueNum);
- this.commentPage = {page: 1};
- this.comments = new issues.CommentsCollection([this.commentPage]);
+ this.comments = new issues.CommentsCollection({pageNumber: 1});
this.initSubViews();
this.fetchModels();
},
@@ -460,7 +459,7 @@ issues.MainView = Backbone.View.extend({
//in consecutive pages
_.each(_.range(2, count), function(i) {
- this.comments.fetchPage({page : i, headers: {'Accept': 'application/json'}});
+ this.comments.fetchPage({pageNumber: i, headers: {'Accept': 'application/json'}});
},this);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment