summaryrefslogtreecommitdiff
path: root/public/js/app.js
blob: 87a4ba6f023700a8230b83a34c203e2f6f640b95 (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
App = Ember.Application.create({
  LOG_TRANSITIONS: true,
  rootElement: '#emberjs-container',

  // Reload the switchboard every x milliseconds
  // if reload_interval != 0
  ready: function() {
    if (reload_interval != 0) {
      var switchboard = App.Switchboard.find(switchboard_id);
      setInterval(function() {
        switchboard.reload();
      }, reload_interval);
    }
  }
});

// Router
App.Router.map(function() {
  this.resource('switchboard', { path: '/' });
});

App.SwitchboardRoute = Ember.Route.extend({
  model: function() {
    return App.Switchboard.find(switchboard_id);
  }
});

// Controller

// 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'),
});

App.SwitchboardEntry = DS.Model.extend({
  switchboard: DS.belongsTo('App.Switchboard'),
  switchboard: DS.belongsTo('App.SipAccount'),
  name: DS.attr('string'),
});

App.SipAccount = DS.Model.extend({
  switchboardEntrys: DS.hasMany('App.SwitchboardEntry'),
  callerName: DS.attr('string'),
});