summaryrefslogtreecommitdiff
path: root/public/js/app.js
blob: 97ed43ee346379937e2df3a80552aec1c0e41fed (plain)
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
68
69
70
71
App = Ember.Application.create({
  LOG_TRANSITIONS: true,
  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! 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')
  }
});

// // Views
// App.SwitchboardView = Ember.View.extend({
//   templateName: 'switchboard'
// });