However, for a couple of actions like e.g sign-in and signup I want a different much simpler header than all the other actions. This is similar to what http://angel.co does when you click Log In. What is the recommended practices for implementing this?
In this solution, how do I make the partial conditional upon which controller or action is currently rendered? The header is in my case not conditional upon if the user is authenticated or not.
You could try to use the render method available to routes. The render method allows you to control which templates, controller and model is used for specific parts of your application. This combined with named outlets might be what you are after.
Route render api:
Named outlets take the form:
{{outlet header}}
So when you enter or exit routes you could render the specific template you need for the header.
employing something similar to @opsb’s route lookup, I was able to get it to work with the following stubs to show the login template without the wrapping content (headers, navbars, etc):
app/controllers/application.js
import Ember from 'ember';
export default Ember.Controller.extend({
isLoginRoute: Ember.computed.equal('currentRouteName', 'login')
});
the class binding was used to ensure no wrapper affects the login template but would otherwise be active but probably there’s a better way out there to achieve this.
@asabjorn a thread I made earlier has a solution to this problem.
probably the easiest thing for you is to have a computed property on your application controller:
showReducedHeader: function(){
//array of all routes without header
var reducedHeader = [
'login',
'logout'
]
//read as reducedHeader.contains('currentPath')
return ($.inArray(this.get('currentPath'), reducedHeader) != -1);
}.property('currentPath')