cms/app-client/app/routes/application.js
changeset 194 02c6aa9a99d7
parent 92 3437f5191645
child 199 b7c691c6179d
--- a/cms/app-client/app/routes/application.js	Sun Jun 19 23:58:21 2016 +0200
+++ b/cms/app-client/app/routes/application.js	Mon Jun 20 15:55:51 2016 +0200
@@ -1,34 +1,48 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
-  serializeQueryParam: function(value, urlKey) {
-    if (urlKey === 'date') {
-      return value;
-    }
-    return '' + value;
-  },
-  deserializeQueryParam: function(value, urlKey) {
-    if (urlKey === 'date') {
-      var arr = [];
-      for (var i = 0; i < value.length; i++) {
-        arr.push(parseInt(value[i]));
-      }
-      return arr;
+
+    model() {
+        return this.store.findAll('document');
+    },
+
+    serializeQueryParam: function(value, urlKey) {
+        if (urlKey === 'date') {
+            return value;
+        }
+        return '' + value;
+    },
+
+    deserializeQueryParam: function(value, urlKey) {
+        if (urlKey === 'date') {
+            var arr = [];
+            for (var i = 0; i < value.length; i++) {
+                arr.push(parseInt(value[i]));
+            }
+            return arr;
+        }
+        return value;
+    },
+
+    actions: {
+
+        willTransition: function() {
+            var _this = this;
+            var queryParams = {};
+            this.controller.get('queryParams').map(function(elt){
+                queryParams[elt] = _this.controller.get(elt);
+            });
+            this.transitionTo({ queryParams: queryParams });
+        },
+
+        didTransition: function() {
+            this._super(...arguments);
+            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());
+            });
+        }
+
     }
 
-    return value;
-  },
-  model() {
-    return this.store.findAll('document');
-  },
-  actions: {
-    willTransition: function() {
-      var _this = this;
-      var queryParams = {};
-      this.controller.get('queryParams').map(function(elt){
-        queryParams[elt] = _this.controller.get(elt);
-      });
-      this.transitionTo({ queryParams: queryParams });
-    }
-  }
 });