Missed in merge
This commit is contained in:
parent
0ab0cf5a6a
commit
14a678092e
7 changed files with 0 additions and 102 deletions
|
@ -1,29 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
|
||||||
actions: {
|
|
||||||
save: function() {
|
|
||||||
let species = this.get('model');
|
|
||||||
|
|
||||||
if (species.get('isDirty')) {
|
|
||||||
species.save().then((species) => {
|
|
||||||
this.transitionToRoute('species.show', species.get('id'));
|
|
||||||
}, (err) => {
|
|
||||||
this.get('flashMessages').error(err.responseJSON.error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.transitionToRoute('species.show', species.get('id'));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
cancel: function() {
|
|
||||||
let species = this.get('model');
|
|
||||||
|
|
||||||
species.get('errors').clear();
|
|
||||||
species.rollback();
|
|
||||||
|
|
||||||
this.transitionToRoute('species.show', species.get('id'));
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,4 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
|
||||||
|
|
||||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {});
|
|
|
@ -1,6 +0,0 @@
|
||||||
{{
|
|
||||||
forms/species-form
|
|
||||||
species=model
|
|
||||||
save="save"
|
|
||||||
cancel="cancel"
|
|
||||||
}}
|
|
|
@ -1,11 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
|
||||||
sortParams: ['speciesName', 'strainCount'],
|
|
||||||
sortedSpecies: Ember.computed.sort('model', 'sortParams'),
|
|
||||||
|
|
||||||
metaData: function() {
|
|
||||||
return this.store.metadataFor('species');
|
|
||||||
}.property('model.isLoaded').readOnly(),
|
|
||||||
|
|
||||||
});
|
|
|
@ -1,8 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
|
||||||
|
|
||||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|
||||||
model: function() {
|
|
||||||
return this.store.findAll('species');
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,30 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
|
||||||
actions: {
|
|
||||||
save: function() {
|
|
||||||
let species = this.get('model');
|
|
||||||
|
|
||||||
if (species.get('isDirty')) {
|
|
||||||
species.save().then((species) => {
|
|
||||||
this.transitionToRoute('species.show', species.get('id'));
|
|
||||||
}, (err) => {
|
|
||||||
this.get('flashMessages').error(err.responseJSON.error);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.transitionToRoute('species.index');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
cancel: function() {
|
|
||||||
let species = this.get('model');
|
|
||||||
|
|
||||||
if (species.get('isNew')) {
|
|
||||||
species.deleteRecord();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.transitionToRoute('species.index');
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,14 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
|
||||||
userCanEdit: function() {
|
|
||||||
let meta = this.store.metadataFor('species');
|
|
||||||
let id = this.get('model.id');
|
|
||||||
|
|
||||||
if (meta.canEdit.indexOf( +id ) === -1) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}.property('model.isLoaded').readOnly(),
|
|
||||||
|
|
||||||
});
|
|
Reference in a new issue