Chaplinjs Composition with two different Site View

67 views Asked by At

I have to two different Site Views with different regions.
How can I in proper way write composition in beforeAction method ?
What I want

beforeAction: function(params, route) {
  if (route === 'sessions#new') {
    this.reuse('site', OutsideSiteView);
    this.reuse('header', OutsideHeaderView);
    this.reuse('footer', OutsideFooterView);
  } else {
    this.reuse('site', SiteView);
    this.reuse('header', HeaderView);
    this.reuse('footer', FooterView);
  }
}
1

There are 1 answers

0
ButuzGOL On BEST ANSWER

My solution was

beforeAction: function(params, route) {
  if (route === 'sessions#new') {
    this.reuse('site', OutsideSiteView, { outside: true });
    this.reuse('header', OutsideHeaderView, { outside: true });
    this.reuse('footer', OutsideFooterView, { outside: true });
  } else {
    this.reuse('site', SiteView);
    this.reuse('header', HeaderView);
    this.reuse('footer', FooterView);
  }
}

But I am not sure that it is proper solution