@@ -38,11 +38,15 @@ issueList.DropdownView = Backbone.View.extend({
38
38
option . addClass ( 'is-active' )
39
39
. siblings ( ) . removeClass ( 'is-active' ) ;
40
40
41
- // TODO: persist in localStorage for page refreshes?
42
41
this . updateDropdownTitle ( option ) ;
43
42
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
+
44
48
// 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 ) ;
46
50
e . preventDefault ( ) ;
47
51
} ,
48
52
updateDropdownTitle : function ( optionElm ) {
@@ -182,6 +186,7 @@ issueList.SortingView = Backbone.View.extend({
182
186
events : { } ,
183
187
initialize : function ( ) {
184
188
this . paginationModel = new Backbone . Model ( {
189
+ // TODO(miket): persist selected page limit to survive page loads
185
190
dropdownTitle : "Show 50" ,
186
191
dropdownOptions : [
187
192
{ title : "Show 25" , paramKey : "per_page" , paramValue : "25" } ,
@@ -276,6 +281,7 @@ issueList.IssueView = Backbone.View.extend({
276
281
}
277
282
} ,
278
283
fetchAndRenderIssues : function ( ) {
284
+ //assumes this.issues.url has already been set to something meaninful.
279
285
var headers = { headers : { 'Accept' : 'application/json' } } ;
280
286
this . issues . fetch ( headers ) . success ( _ . bind ( function ( ) {
281
287
this . render ( this . issues ) ;
0 commit comments