Linting errors / Parenthesis missing / Body classname
authorChloe Laisne <chloe.laisne@gmail.com>
Mon, 20 Jun 2016 15:55:51 +0200
changeset 194 02c6aa9a99d7
parent 193 64afd482ac71
child 195 9d083636bd99
Linting errors / Parenthesis missing / Body classname
cms/app-client/app/components/discourses-component.js
cms/app-client/app/controllers/application.js
cms/app-client/app/routes/application.js
--- a/cms/app-client/app/components/discourses-component.js	Sun Jun 19 23:58:21 2016 +0200
+++ b/cms/app-client/app/components/discourses-component.js	Mon Jun 20 15:55:51 2016 +0200
@@ -54,11 +54,11 @@
                 .text(function(d) { return d.name; })
                 .style("text-align", "center")
                 .style("display", function(d) { return d.children ? 'none' : 'inline-block'; })
-                .style("width", function() { return $(this).parent().width() > $(this).width() ? $(this).parent().width() + 'px' : ''; })
+                .style("width", function() { return Ember.$(this).parent().width() > Ember.$(this).width() ? Ember.$(this).parent().width() + 'px' : ''; })
                 .style("text-transform", "capitalize")
                 .style("font-size", "15px")
-                .style("margin-left", function() { return ( $(this).width() > $(this).parent().width() ? - ( $(this).width() / 2 ) + ( $(this).parent().width() / 2 ) : 0 ) + 'px'; })
-                .style("margin-top", function() { return $(this).parent().height() / 2 - $(this).height() / 2 + 'px'; });
+                .style("margin-left", function() { return ( Ember.$(this).width() > Ember.$(this).parent().width() ? - ( Ember.$(this).width() / 2 ) + ( Ember.$(this).parent().width() / 2 ) : 0 ) + 'px'; })
+                .style("margin-top", function() { return Ember.$(this).parent().height() / 2 - Ember.$(this).height() / 2 + 'px'; });
 
             var svg = element.append("svg")
                 .style("width", width + "px")
--- a/cms/app-client/app/controllers/application.js	Sun Jun 19 23:58:21 2016 +0200
+++ b/cms/app-client/app/controllers/application.js	Mon Jun 20 15:55:51 2016 +0200
@@ -34,7 +34,7 @@
             return null;
         }
         Ember.$("div[id='" + this.get('currentId') + "']").toggleClass("playing", true);
-        return this.store.findRecord('document', this.get('currentId');
+        return this.store.findRecord('document', this.get('currentId'));
     }),
 
     modalItem: Ember.computed('detail', function() {
--- 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 });
-    }
-  }
 });