Pods, pods, everywhere
This commit is contained in:
parent
33f783bc42
commit
e623d52f34
66 changed files with 53 additions and 113 deletions
21
app/pods/species/new/controller.js
Normal file
21
app/pods/species/new/controller.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
isEditing: true,
|
||||
actions: {
|
||||
save: function() {
|
||||
var species = this.get('model');
|
||||
if (species.get('isDirty')) {
|
||||
species.save();
|
||||
}
|
||||
this.transitionToRoute('species.index');
|
||||
},
|
||||
cancel: function() {
|
||||
var species = this.get('model');
|
||||
if (species.get('isNew')) {
|
||||
species.deleteRecord();
|
||||
}
|
||||
this.transitionToRoute('species.index');
|
||||
}
|
||||
}
|
||||
});
|
12
app/pods/species/new/route.js
Normal file
12
app/pods/species/new/route.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function() {
|
||||
return this.store.createRecord('species');
|
||||
},
|
||||
actions: {
|
||||
cancelSpecies: function() {
|
||||
this.transitionTo('species.index');
|
||||
}
|
||||
}
|
||||
});
|
7
app/pods/species/new/template.hbs
Normal file
7
app/pods/species/new/template.hbs
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{
|
||||
species-details
|
||||
species=model
|
||||
isEditing=true
|
||||
save="save"
|
||||
cancel="cancel"
|
||||
}}
|
Reference in a new issue