Skip to content

Commit

Permalink
Issue #639: Extract addParamsToModel from updateModelParams.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Jul 30, 2015
1 parent 9de2a48 commit e24a1c8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions webcompat/static/js/lib/issue-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,16 @@ issueList.IssueView = Backbone.View.extend({

this.fetchAndRenderIssues();
},
addParamsToModel: function(paramsArray) {
// this method just puts the params in the model's params property.
// paramsArray is an array of param 'key=value' string pairs
_.forEach(paramsArray, _.bind(function(param) {
var kvArray = param.split('=');
var key = kvArray[0];
var value = kvArray[1];
this.issues.params[key] = value;
}, this));
},
updateModelParams: function(params, options) {
// we convert the params string into an array, splitting
// on '&' in case of multiple params. those are then
Expand All @@ -500,13 +510,7 @@ issueList.IssueView = Backbone.View.extend({
delete this.issues.params['q'];
}

// paramsArray is an array of param 'key=value' string pairs
_.forEach(paramsArray, _.bind(function(param) {
var kvArray = param.split('=');
var key = kvArray[0];
var value = kvArray[1];
this.issues.params[key] = value;
}, this));
this.addParamsToModel(paramsArray);

//broadcast to each of the dropdowns that they need to update
var pageDropdown;
Expand Down

0 comments on commit e24a1c8

Please sign in to comment.