This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/pods/protected/species/edit/route.js

24 lines
597 B
JavaScript

import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
this._super(transition);
this.get('session.currentUser').then((user) => {
if (user.get('isReader')) {
this.transitionTo('protected.species.index');
}
});
},
afterModel: function(species) {
if (!species.get('canEdit')) {
this.transitionTo('species.show', species.get('id'));
}
},
setupController: function(controller, model) {
controller.set('model', model);
controller.set('metaData', this.store.metadataFor('species'));
},
});