-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
67 lines (50 loc) · 2.2 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
define( function( require ) {
var Marionette = require( 'marionette' ),
Backbone = require( 'backbone' ),
Router = require( 'Router' ),
Controller = require( 'Controller' ),
NavigationView = require( 'view/Navigation' ),
RedThemeModule = require( 'module/RedTheme/Module' ),
BlueThemeModule = require( 'module/BlueTheme/Module' ),
UniversalFooter = require( 'view/UniversalFooter' );
return Marionette.Application.extend( {
/**
* Define the regions for the application.
*
* @returns {Object}
*/
regions: function() {
return {
// You can use jquery format to select regions, I'm just using
// tagnames for simplicity sake
regionHeader: 'header',
regionNav: 'nav',
regionMain: 'section',
regionFooter: 'footer'
};
},
/**
*
* @param {Object} options
*/
start: function( options ) {
var navigationView = new NavigationView();
// Perform the default 'start' functionality
Marionette.Application.prototype.start.apply( this, [ options ] );
// Add in the site navigation
this.regionNav.show( navigationView );
// Add routers
this.Router = new Router( { controller: new Controller() } );
// Add modules
this.module( 'BlueThemeModule', { moduleClass: BlueThemeModule } );
this.module( 'RedThemeModule', { moduleClass: RedThemeModule } );
// This is a very simple demo, and as such I'm going to use
// hashes for internal navigation. If you want Backbone/Marionette
// to enforce full URLs use:
// Backbone.history.start( { pushState: true } );
Backbone.history.start( );
// show the footer
this.regionFooter.show( new UniversalFooter() );
}
} );
} );