cms/app-client/app/routes/application.js
changeset 199 b7c691c6179d
parent 194 02c6aa9a99d7
child 201 9ae2cf79d167
--- a/cms/app-client/app/routes/application.js	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/routes/application.js	Thu Jun 23 11:35:26 2016 +0200
@@ -27,16 +27,23 @@
     actions: {
 
         willTransition: function() {
-            var _this = this;
-            var queryParams = {};
-            this.controller.get('queryParams').map(function(elt){
-                queryParams[elt] = _this.controller.get(elt);
+            // Prevent navigation from removing query parameters
+            var _this = this,
+                queryParams = {};
+            this.controller.get('queryParams').map(function(parameter){
+                if(typeof parameter === 'object') {
+                    Object.keys(parameter).forEach(function(value, key, array) {
+                        queryParams[value] = _this.controller.get(value);
+                    });
+                } else {
+                    queryParams[parameter] = _this.controller.get(parameter);
+                }
             });
             this.transitionTo({ queryParams: queryParams });
         },
 
         didTransition: function() {
-            this._super(...arguments);
+            // Append body classname depending on the route
             Ember.$('body').removeClass((this.controller.get('currentPath') || '').replace(/\//g, '-').dasherize());
             Ember.run.once(this, function() {
                 Ember.$('body').addClass((this.controller.get('currentPath') ||'').replace(/\//g, '-').dasherize());