Skip to content

Commit d8684c7

Browse files
author
Mike Taylor
committed
Issue #372: dropdown:change should fire key and value as distinct args.
1 parent 56272ad commit d8684c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ issueList.DropdownView = Backbone.View.extend({
3838
option.addClass('is-active')
3939
.siblings().removeClass('is-active');
4040

41-
// TODO: persist in localStorage for page refreshes?
4241
this.updateDropdownTitle(option);
4342

43+
// persist value of selection to be used on subsequent page loads
44+
if ('localStorage' in window) {
45+
window.localStorage.setItem(paramKey, paramValue);
46+
}
47+
4448
// fire an event so other views can react to dropdown changes
45-
wcEvents.trigger('dropdown:change', {params: {key: paramKey, value: paramValue}});
49+
wcEvents.trigger('dropdown:change', paramKey, paramValue);
4650
e.preventDefault();
4751
},
4852
updateDropdownTitle: function(optionElm) {
@@ -182,6 +186,7 @@ issueList.SortingView = Backbone.View.extend({
182186
events: {},
183187
initialize: function() {
184188
this.paginationModel = new Backbone.Model({
189+
// TODO(miket): persist selected page limit to survive page loads
185190
dropdownTitle: "Show 50",
186191
dropdownOptions: [
187192
{title: "Show 25", paramKey: "per_page", paramValue: "25"},
@@ -276,6 +281,7 @@ issueList.IssueView = Backbone.View.extend({
276281
}
277282
},
278283
fetchAndRenderIssues: function() {
284+
//assumes this.issues.url has already been set to something meaninful.
279285
var headers = {headers: {'Accept': 'application/json'}};
280286
this.issues.fetch(headers).success(_.bind(function() {
281287
this.render(this.issues);

0 commit comments

Comments
 (0)