javascript - How to Change body background for different pages in ember -


i developing ember app , have white background signup page , login page , rest of pages should have grey background.

at moment changing colours of body tag in controller (application.js file)

import ember 'ember';  export default ember.controller.extend({   isverified:false,   bgcolour: function(){     if(['users.login','users.signup'].indexof(this.get('currentpath')) != -1){       return 'white';     }     else{       return 'bg-grey';     }   }.property('currentpath'), }); 

any advices how make better/cleaner way?

we have deal lot of arbitrary requests our clients easiest way target specific page, add route name body.

ember.route.reopen({   activate: function() {     var cssclass = this.tocssclass();     // don't need application class     // added body     if (cssclass != 'application') {       ember.$('body').addclass(cssclass);     }   },   deactivate: function() {     ember.$('body').removeclass(this.tocssclass());   },   tocssclass: function() {     return this.routename.replace(/\./g, '-').dasherize();   } }); 

that said it's big dirty, create thememixin , set on routes. it's simpler version of this: https://github.com/ronco/ember-cli-meta-tags


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -