summaryrefslogtreecommitdiff
path: root/public/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/app.js')
-rw-r--r--public/js/app.js58
1 files changed, 20 insertions, 38 deletions
diff --git a/public/js/app.js b/public/js/app.js
index 97ed43e..87a4ba6 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -1,42 +1,31 @@
App = Ember.Application.create({
LOG_TRANSITIONS: true,
- rootElement: '#container'
+ 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('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);
- }
+ this.resource('switchboard', { path: '/' });
});
-App.SwitchboardsRoute = Ember.Route.extend({
+App.SwitchboardRoute = Ember.Route.extend({
model: function() {
- return App.Switchboard.find();
+ return App.Switchboard.find(switchboard_id);
}
});
-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({
@@ -50,22 +39,15 @@ DS.RESTAdapter.configure("plurals", {
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'),
+ switchboard: DS.belongsTo('App.SipAccount'),
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
+App.SipAccount = DS.Model.extend({
+ switchboardEntrys: DS.hasMany('App.SwitchboardEntry'),
+ callerName: DS.attr('string'),
+}); \ No newline at end of file