diff --git a/app/initializers/custom-session.js b/app/initializers/custom-session.js index c6a230a..a4b66b9 100644 --- a/app/initializers/custom-session.js +++ b/app/initializers/custom-session.js @@ -7,7 +7,7 @@ var CustomSession = Session.extend({ let token = this.get('secure.token'); if (!Ember.isEmpty(token)) { let t = parseBase64(token); - return this.container.lookup('store:main').find('user', t['sub']); + return this.container.lookup('service:store').find('user', t['sub']); } return null; }.property('secure.token'), diff --git a/app/pods/application/adapter.js b/app/pods/application/adapter.js index a2c9722..0a943ec 100644 --- a/app/pods/application/adapter.js +++ b/app/pods/application/adapter.js @@ -29,4 +29,13 @@ export default DS.RESTAdapter.extend({ return error; } }, + + shouldReloadAll: function() { + return true; + }, + + shouldBackgroundReloadRecord: function() { + return false; + } + }); diff --git a/app/pods/protected/species/edit/controller.js b/app/pods/protected/species/edit/controller.js index d8fae89..f8edd94 100644 --- a/app/pods/protected/species/edit/controller.js +++ b/app/pods/protected/species/edit/controller.js @@ -5,7 +5,7 @@ export default Ember.Controller.extend({ save: function() { let species = this.get('model'); - if (species.get('isDirty')) { + if (species.get('hasDirtyAttributes')) { species.save().then((species) => { this.transitionToRoute('protected.species.show', species); }, (err) => { diff --git a/app/pods/protected/species/index/controller.js b/app/pods/protected/species/index/controller.js index 00f9448..77916f1 100644 --- a/app/pods/protected/species/index/controller.js +++ b/app/pods/protected/species/index/controller.js @@ -3,9 +3,4 @@ import Ember from 'ember'; export default Ember.Controller.extend({ sortParams: ['speciesName', 'strainCount'], sortedSpecies: Ember.computed.sort('model', 'sortParams'), - - metaData: function() { - return Ember.copy(this.store.metadataFor('species')); - }.property('model.isLoaded').readOnly(), - }); diff --git a/app/pods/protected/species/index/route.js b/app/pods/protected/species/index/route.js index 8f05241..755edff 100644 --- a/app/pods/protected/species/index/route.js +++ b/app/pods/protected/species/index/route.js @@ -3,5 +3,11 @@ import Ember from 'ember'; export default Ember.Route.extend({ model: function() { return this.store.findAll('species'); - } + }, + + setupController: function(controller, model) { + controller.set('model', model); + controller.set('metaData', this.store.metadataFor('species')); + }, + }); diff --git a/app/pods/protected/species/new/controller.js b/app/pods/protected/species/new/controller.js index dfe5127..cb5a59d 100644 --- a/app/pods/protected/species/new/controller.js +++ b/app/pods/protected/species/new/controller.js @@ -5,7 +5,7 @@ export default Ember.Controller.extend({ save: function() { let species = this.get('model'); - if (species.get('isDirty')) { + if (species.get('hasDirtyAttributes')) { species.save().then((species) => { this.transitionToRoute('protected.species.show', species.get('id')); }, (err) => { diff --git a/app/pods/protected/strains/edit/controller.js b/app/pods/protected/strains/edit/controller.js index 0b26876..e570dff 100644 --- a/app/pods/protected/strains/edit/controller.js +++ b/app/pods/protected/strains/edit/controller.js @@ -5,7 +5,7 @@ export default Ember.Controller.extend({ save: function() { let strain = this.get('strain'); - if (strain.get('isDirty')) { + if (strain.get('hasDirtyAttributes')) { strain.save().then((strain) => { this.transitionToRoute('protected.strains.show', strain); }, (err) => { diff --git a/app/pods/protected/strains/index/controller.js b/app/pods/protected/strains/index/controller.js index 07954e7..45eb163 100644 --- a/app/pods/protected/strains/index/controller.js +++ b/app/pods/protected/strains/index/controller.js @@ -3,9 +3,4 @@ import Ember from 'ember'; export default Ember.Controller.extend({ sortParams: ['fullNameMU', 'totalMeasurements'], sortedStrains: Ember.computed.sort('model', 'sortParams'), - - metaData: function() { - return Ember.copy(this.store.metadataFor('strain')); - }.property('model.isLoaded').readOnly(), - }); diff --git a/app/pods/protected/strains/index/route.js b/app/pods/protected/strains/index/route.js index 9a19a1c..14b7a5c 100644 --- a/app/pods/protected/strains/index/route.js +++ b/app/pods/protected/strains/index/route.js @@ -4,4 +4,10 @@ export default Ember.Route.extend({ model: function() { return this.store.findAll('strain'); }, + + setupController: function(controller, model) { + controller.set('model', model); + controller.set('metaData', this.store.metadataFor('strain')); + }, + }); diff --git a/app/pods/protected/strains/index/template.hbs b/app/pods/protected/strains/index/template.hbs index 2d40098..077d22a 100644 --- a/app/pods/protected/strains/index/template.hbs +++ b/app/pods/protected/strains/index/template.hbs @@ -14,7 +14,7 @@ {{#each sortedStrains as |row|}} - {{#link-to 'protected.strains.show' row.id classBinding="data.typeStrain:type-strain"}} + {{#link-to 'protected.strains.show' row classBinding="data.typeStrain:type-strain"}} {{row.fullNameMU}} {{/link-to}} diff --git a/app/pods/protected/strains/new/controller.js b/app/pods/protected/strains/new/controller.js index 3041572..23fafed 100644 --- a/app/pods/protected/strains/new/controller.js +++ b/app/pods/protected/strains/new/controller.js @@ -5,7 +5,7 @@ export default Ember.Controller.extend({ save: function() { let strain = this.get('strain'); - if (strain.get('isDirty')) { + if (strain.get('hasDirtyAttributes')) { strain.save().then((strain) => { this.transitionToRoute('protected.strains.show', strain); }, (err) => { diff --git a/app/pods/users/new/new-user-form/component.js b/app/pods/users/new/new-user-form/component.js index dd41ea0..4d8b815 100644 --- a/app/pods/users/new/new-user-form/component.js +++ b/app/pods/users/new/new-user-form/component.js @@ -15,7 +15,7 @@ export default Ember.Component.extend({ return; } - if (user.get('isDirty')) { + if (user.get('hasDirtyAttributes')) { user.save().then(() => { this.sendAction(); }).catch(() => {