diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-03-25 10:26:49 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-04-03 22:09:33 +0200 |
commit | 877364c24ef9c7954f0e193456bb3f2d39169977 (patch) | |
tree | 67ccc220fc9a98300356855f0c9e3b6f13d37223 /public/js/app.js | |
parent | 595e5f9d32c9dda8f7b6c0dd5e7e4fba4693eca4 (diff) |
First try
Diffstat (limited to 'public/js/app.js')
-rw-r--r-- | public/js/app.js | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/public/js/app.js b/public/js/app.js index 238f29e..97ed43e 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -3,14 +3,69 @@ App = Ember.Application.create({ rootElement: '#container' }); +// Router +App.Router.map(function() { + this.resource('switchboards', function() { + this.resource('switchboard', { path: ':switchboard_id' }); + }); +}); App.ApplicationRoute = Ember.Route.extend({ setupController: function(controller) { // `controller` is the instance of ApplicationController - controller.set('title', "Hello world!"); + controller.set('title', "Hello world! Switchboard #" + switchboard_id); + } +}); + +App.SwitchboardsRoute = Ember.Route.extend({ + model: function() { + return App.Switchboard.find(); } }); +App.IndexRoute = Ember.Route.extend({ + redirect: function() { + this.transitionTo('switchboard', App.Switchboard.find(switchboard_id)); + } +}); + +// Controller App.ApplicationController = Ember.Controller.extend({ appName: 'My First Example' -});
\ No newline at end of file +}); + +App.SwitchboardsController = Ember.ArrayController.extend({ + // switchboardEntrys: table.get('tab.tabItems') +}) + +// Models +App.Store = DS.Store.extend({ + revision: 11 +}); + +DS.RESTAdapter.configure("plurals", { + switchboard_entry: "switchboard_entries" +}); + +App.Switchboard = DS.Model.extend({ + switchboardEntrys: DS.hasMany('App.SwitchboardEntry'), + name: DS.attr('string'), + didLoad: function() { + console.log('Switchboard model loaded') + } +}); + + + +App.SwitchboardEntry = DS.Model.extend({ + switchboard: DS.belongsTo('App.Switchboard'), + name: DS.attr('string'), + didLoad: function() { + console.log('SwitchboardEntry model loaded') + } +}); + +// // Views +// App.SwitchboardView = Ember.View.extend({ +// templateName: 'switchboard' +// });
\ No newline at end of file |