Uncaught Error: No region registered under committer

10 views
Skip to first unread message

Brian Brown

unread,
Oct 22, 2015, 3:33:55 PM10/22/15
to Chaplin
Hello all,

I'm new to ChaplinJS and have spent time looking at the example apps that shown on the site. I'm using the brunch with chaplin template and workflow.

I have a structure that has 4 controllers, and I can navigate to each controller and everything renders as I expect. I can navigate to the the route 'user#index' and it renders fine. Any of the other routes corresponding the controller get called, but through the error above. I have added divs with the id's corresponding to the 'committer' and 'detail' region keys to both the parent template, and then the child template as well; neither of these has made any difference.

I have (attempted to) added three subviews into one of the controllers

HomeController = require 'controllers/home-controller'
HeaderView = require 'views/home/header-view'
FooterView = require 'views/home/footer-view'
UserPageView = require 'views/user/user-page-view'
UserDataView = require 'views/user/user-data-view'
InfoView = require 'views/info-view'

module.exports = class UserController extends HomeController

  beforeAction: (params, route) ->
    super
    console.log route.name

  index: ->
    console.log 'index'
    @view = new UserPageView region: 'main'

  data: ->
    @view = new UserDataView region: 'committer'
    console.log 'data'
 

  visual: ->
    @view = new UserDataView region: 'committer'
  
  detail: ->
    @view = new UserDataView region: 'detail'
    console.log 'detail'
 

And the associated view and template:

View = require 'views/base/view'

module.exports = class UserPageView extends View
  id: 'user-page'
  autoRender: true
  className: 'home-page'
  region: 'main'
  regions:
    committer: '#committer-container'
    detail: '#detail-container'

  template: require './templates/user'

user.hbs:

<p>This is the Committer page</p>
<ul>
    <li><a data-name="user#index" class="header-link"  href="user">Home</a></li>
    <li><a data-name="user#data" class="header-link"   href="user/data">Data View</a></li>
    <li><a data-name="user#visual" class="header-link" href="user/visual">Visualization</a></li>
    <li><a data-name="user#detail" class="header-link" href="user/detail">Detail</a></li>
</ul>
<div class="committer-container" id="committer-container"></div>
<div class="detail-container" id="detail-container"></div>



But I get the error in the subject line. Initially I didn't override the beforeAction method, as I saw some references to that fixing similar issues, but it had no effect in this case. I also saw a refrerence to a subviews() call, but that isn't in the current docs. Below is the UserDetailView as a representative of the subviews:

View = require 'views/base/view'

module.exports = class UserDataView extends View
  id: 'user-data'
  autoRender: true
  className: 'home-page'
  region: 'committer'
  template: require './templates/user-data'


... and the template user-data.hbs:

<p>This is the User data, you </p>
<ul>
    <li><a data-name="user#index" class="header-link"  href="user">Home</a></li>
</ul>
<div class="committer-container" id="committer-container"></div>
<div class="detail-container" id="detail-container"></div>


Any help would be much appreciated!

-- Brian
Reply all
Reply to author
Forward
0 new messages