Skip to content

Instantly share code, notes, and snippets.

@mattd
Created January 8, 2013 20:55
Show Gist options
  • Save mattd/4487827 to your computer and use it in GitHub Desktop.
Save mattd/4487827 to your computer and use it in GitHub Desktop.
define([
'vent',
'routers/manage/groups',
'routers/manage/learners',
'controllers/manage/groups',
'controllers/manage/learners',
'views/layouts/manage/module',
'views/tab/collection',
'collections/client/tab'
], function (
vent,
ManageGroupsRouter,
ManageLearnersRouter,
ManageGroupsController,
ManageLearnersController,
ManageModuleLayout,
TabCollectionView,
TabCollection
) {
"use strict";
return function (manageModule, app) {
this.config.options.startWithParent = false;
this.addInitializer(function () {
var layout = new ManageModuleLayout();
layout.primaryNav.show(
new TabCollectionView({
collection: new TabCollection([
{id: 'learners', text: 'Learners Tab'},
{id: 'groups', text: 'Groups Tab'}
])
})
);
this.config.app.canvas.show(layout);
vent.currentContentRegion = layout.content;
});
app.addInitializer(function () {
new ManageGroupsRouter({
controller: new ManageGroupsController()
});
new ManageLearnersRouter({
controller: new ManageLearnersController()
});
});
};
});
@mxriverlynn
Copy link

this.addInitializer(function () {
    var layout = new ManageModuleLayout();

    // wait for the layout to be rendered before showing anything in it's regions 
    layout.on("render", function(){       

            layout.primaryNav.show(
                new TabCollectionView({
                    collection: new TabCollection([
                        {id: 'learners', text: 'Learners Tab'},
                        {id: 'groups', text: 'Groups Tab'}
                    ])
                })
            );

     });

     this.config.app.canvas.show(layout);
     vent.currentContentRegion = layout.content;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment