Replace calls to store for metaData with user CP

Fixes #25.
This commit is contained in:
Matthew Ryan Dillon 2015-10-20 10:07:29 -07:00
parent be81bb9066
commit 43bc7645f2
6 changed files with 25 additions and 5 deletions

View file

@ -1,3 +1,4 @@
import Ember from 'ember';
import DS from 'ember-data'; import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
@ -33,4 +34,13 @@ export default DS.Model.extend({
return 'Error'; return 'Error';
} }
}.property('role'), }.property('role'),
canWrite: Ember.computed('role', function() {
return this.get('role') !== 'R';
}),
metaData: Ember.computed('canWrite', function() {
return { 'canAdd': this.get('canWrite') };
}),
}); });

View file

@ -7,7 +7,9 @@ export default Ember.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
controller.set('metaData', this.store.metadataFor('characteristic')); this.get('session.currentUser').then((user) => {
controller.set('metaData', user.get('metaData'));
});
}, },
}); });

View file

@ -18,7 +18,9 @@ export default Ember.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
controller.set('metaData', this.store.metadataFor('species')); this.get('session.currentUser').then((user) => {
controller.set('metaData', user.get('metaData'));
});
}, },
}); });

View file

@ -7,7 +7,9 @@ export default Ember.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
controller.set('metaData', this.store.metadataFor('species')); this.get('session.currentUser').then((user) => {
controller.set('metaData', user.get('metaData'));
});
}, },
}); });

View file

@ -26,7 +26,9 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
setupController: function(controller, models) { setupController: function(controller, models) {
controller.setProperties(models); controller.setProperties(models);
controller.set('metaData', this.store.metadataFor('strain')); this.get('session.currentUser').then((user) => {
controller.set('metaData', user.get('metaData'));
});
}, },
}); });

View file

@ -7,7 +7,9 @@ export default Ember.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
controller.set('metaData', this.store.metadataFor('strain')); this.get('session.currentUser').then((user) => {
controller.set('metaData', user.get('metaData'));
});
}, },
}); });