Commit df296b9c authored by Stas SUȘCOV's avatar Stas SUȘCOV

Use latest ember.js, add basic routing support.

parent 428dc1ae
......@@ -3,7 +3,8 @@ require.config({
baseUrl: 'js/',
paths: {
jquery: '../../../assets/jquery.min',
ember: 'lib/ember-0.9.8.1.min',
ember: 'http://cloud.github.com/downloads/emberjs/ember.js/ember-latest.min',
// ember: 'lib/ember-0.9.8.1.min',
text: 'lib/require/text',
mocha: 'lib/mocha',
chai: 'lib/chai'
......@@ -12,34 +13,28 @@ require.config({
// Load our app
define( 'app', [
'jquery',
'app/router',
'app/models/store',
'app/controllers/todos',
'jquery',
'ember',
], function( $, Store, TodosController ) {
], function( Router, Store, TodosController ) {
var App = Ember.Application.create({
VERSION: '0.2-omfg',
VERSION: '0.2',
// Constructor
init: function() {
this._super();
// Initiate main controller
this.set(
'todosController',
TodosController.create({
store: new Store( 'todos-emberjs' )
})
);
// Run specs if asked
if ( location.hash.match( /specs/ ) ) {
require( [ 'app/specs/helper' ] );
}
this.set( 'todosController', TodosController.create(
{ store: new Store( 'todos-emberjs' ) }
) );
}
});
// Initialize Application to load routes
App.Router = Router;
App.initialize();
// Expose the application globally
return window.Todos = App;
}
......
define('app/router', [ 'ember' ],
/**
* Todos Router
*
* Defined routes represent filters according to specs
*
* @returns Class
*/
function( ItemsView, StatsView, FiltersView, ClearBtnView ) {
return Ember.Router.extend({
enableLogging: true,
root: Ember.Route.extend({
showAll: Ember.Route.transitionTo( 'index' ),
showActive: Ember.Route.transitionTo( 'active' ),
showCompleted: Ember.Route.transitionTo( 'completed' ),
index: Ember.Route.extend({
route: '/',
}),
active: Ember.Route.extend({
route: '/active',
}),
completed: Ember.Route.extend({
route: '/completed',
}),
specs: Ember.Route.extend({
route: '/specs',
connectOutlets: function() {
require( [ 'app/specs/helper' ] );
}
})
})
});
}
);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment