diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-04-03 22:08:19 +0200 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-04-03 22:09:33 +0200 |
commit | cea2cc3c1cc1e48fc4600c698d52dfda2bde4505 (patch) | |
tree | e216a9634c31047e8908a882aed9ff2545ed99e6 /public/js/app.js | |
parent | 64653a9149eca977c16233abb0a472730b94a464 (diff) |
Massive changes to the switchboard.
Diffstat (limited to 'public/js/app.js')
-rw-r--r-- | public/js/app.js | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/public/js/app.js b/public/js/app.js index 87a4ba6..4bc8cc1 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -9,6 +9,11 @@ App = Ember.Application.create({ var switchboard = App.Switchboard.find(switchboard_id); setInterval(function() { switchboard.reload(); + + // var switchboard_entries = App.SwitchboardEntry.find(); + // switchboard_entries.forEach(function(switchboard_entry) { + // switchboard_entry.reload(); + // }); }, reload_interval); } } @@ -29,25 +34,57 @@ App.SwitchboardRoute = Ember.Route.extend({ // Models App.Store = DS.Store.extend({ - revision: 11 + revision: 12 }); DS.RESTAdapter.configure("plurals", { switchboard_entry: "switchboard_entries" }); +DS.RESTAdapter.reopen({ + namespace: 'api/v1' +}); + App.Switchboard = DS.Model.extend({ switchboardEntrys: DS.hasMany('App.SwitchboardEntry'), - name: DS.attr('string'), + name: DS.attr('string') }); App.SwitchboardEntry = DS.Model.extend({ switchboard: DS.belongsTo('App.Switchboard'), - switchboard: DS.belongsTo('App.SipAccount'), + sipAccount: DS.belongsTo('App.SipAccount'), name: DS.attr('string'), + path_to_user: DS.attr('string'), + avatar_src: DS.attr('string'), + callstate: DS.attr('string') }); +App.Adapter = DS.RESTAdapter.extend(); + +App.store = App.Store.create({ + adapter: App.Adapter.create() +}); + +App.store.adapter.serializer.configure(App.SwitchboardEntry, { sideloadAs: 'switchboard_entries' }); + App.SipAccount = DS.Model.extend({ switchboardEntrys: DS.hasMany('App.SwitchboardEntry'), + phoneNumbers: DS.hasMany('App.PhoneNumber'), callerName: DS.attr('string'), -});
\ No newline at end of file + authName: DS.attr('string') +}); + +App.PhoneNumber = DS.Model.extend({ + name: DS.attr('string'), + number: DS.attr('string') +}); + +App.store.adapter.serializer.configure(App.PhoneNumber, { sideloadAs: 'phone_numbers' }); + +Ember.Handlebars.registerBoundHelper('avatar_img', function(value) { + return new Handlebars.SafeString('<img alt="Avatar image" class="img-rounded" src="' + value + '" style="width: 100px;">'); +}); + +Ember.Handlebars.registerBoundHelper('show_callstate', function(value) { + return new Handlebars.SafeString('<span class="label">' + value + '</span>'); +}); |