summaryrefslogtreecommitdiff
path: root/public/js/old2-app.js
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-03 22:10:32 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-03 22:10:32 +0200
commit4ebbcf3b5576cc342086e2f54950a119a49f2bf9 (patch)
treee216a9634c31047e8908a882aed9ff2545ed99e6 /public/js/old2-app.js
parentedf06bf6f7d4f20d5a9145a5bbf8db409fe6ab1b (diff)
parentcea2cc3c1cc1e48fc4600c698d52dfda2bde4505 (diff)
Merge branch 'emberjs' into develop
Diffstat (limited to 'public/js/old2-app.js')
-rw-r--r--public/js/old2-app.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/public/js/old2-app.js b/public/js/old2-app.js
new file mode 100644
index 0000000..4ee9ac9
--- /dev/null
+++ b/public/js/old2-app.js
@@ -0,0 +1,64 @@
+App = Ember.Application.create({
+ LOG_TRANSITIONS: true,
+ rootElement: '#emberjs-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! 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'
+});
+
+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')
+ }
+});