equal
deleted
inserted
replaced
25 }, |
25 }, |
26 |
26 |
27 actions: { |
27 actions: { |
28 |
28 |
29 willTransition: function() { |
29 willTransition: function() { |
30 var _this = this; |
30 // Prevent navigation from removing query parameters |
31 var queryParams = {}; |
31 var _this = this, |
32 this.controller.get('queryParams').map(function(elt){ |
32 queryParams = {}; |
33 queryParams[elt] = _this.controller.get(elt); |
33 this.controller.get('queryParams').map(function(parameter){ |
|
34 if(typeof parameter === 'object') { |
|
35 Object.keys(parameter).forEach(function(value, key, array) { |
|
36 queryParams[value] = _this.controller.get(value); |
|
37 }); |
|
38 } else { |
|
39 queryParams[parameter] = _this.controller.get(parameter); |
|
40 } |
34 }); |
41 }); |
35 this.transitionTo({ queryParams: queryParams }); |
42 this.transitionTo({ queryParams: queryParams }); |
36 }, |
43 }, |
37 |
44 |
38 didTransition: function() { |
45 didTransition: function() { |
39 this._super(...arguments); |
46 // Append body classname depending on the route |
40 Ember.$('body').removeClass((this.controller.get('currentPath') || '').replace(/\//g, '-').dasherize()); |
47 Ember.$('body').removeClass((this.controller.get('currentPath') || '').replace(/\//g, '-').dasherize()); |
41 Ember.run.once(this, function() { |
48 Ember.run.once(this, function() { |
42 Ember.$('body').addClass((this.controller.get('currentPath') ||'').replace(/\//g, '-').dasherize()); |
49 Ember.$('body').addClass((this.controller.get('currentPath') ||'').replace(/\//g, '-').dasherize()); |
43 }); |
50 }); |
44 } |
51 } |