Ember mixins - is this a good way to achieve 'dynamic' layout

So, I posted this question on SO already, but I think it is maybe better suited for a discussion, rather than being a ‘concrete, answerable question’. C/P from SO:

What I’m trying to achieve:

The app has a few “main sections”, such as top panel, sidebar, and of course content. I would like to have a per-route ‘configuration’ which of those are shown (content is always present), with most routes having same, default, layout.

My solution:

  • Application template binds each section’s visibility to relevant ApplicationController property
  • I have a LayoutMixin which, upon entering the route, gets the route’s layoutSettings property, and updates the ApplicationController properties accordingly
  • When leaving the route, mixin reverts back the previous state

Minimalistic example: JS Bin - Collaborative JavaScript Debugging

The approach works, and I quite like the concept of using mixin + ‘config data’ to make things happen ‘automagically’ (I’m also doing a similar thing for breadcrumbs), but am kinda worried I’m reducing clarity of what is going on, or that I’m not seeing something that may blow up at some later point.

Is this “the Ember way” of doing things?

Additionally: how to write unit tests for such mixin?

Link to SO question: javascript - Ember mixins - is this a good way to achieve 'dynamic' layout - Stack Overflow

Apologies if this is inapropriate question.

Answered via Stack Overflow.