Created
February 9, 2015 20:39
-
-
Save HERRKIN/d82572169c8914bbfa7e to your computer and use it in GitHub Desktop.
problem with view select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//item controller for article | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
states: ['borrowed', 'returned'], | |
autoSave: function() { | |
if (!this.get('model.isNew')) { | |
this.send('save', this.get('model')); | |
} | |
}, | |
isDirtyChanged: function() { | |
if(this.get('model.isDirty')===true){ | |
console.log(this.get('model.isDirty')); | |
} | |
if (this.get('model.isDirty') && !this.get('model.isSaving')) { | |
Ember.run.once(this, this.autoSave); | |
} | |
}.on('init').observes('model.isDirty') | |
}); | |
//template for articles index | |
<h2>Articles Index</h2> | |
<table class="primary"> | |
<thead> | |
<tr> | |
<th>Description</th> | |
<th>notes</th> | |
<th>Borrowed since</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> | |
{{#each itemController='articles/item'}} | |
<tr> | |
<td>{{model.description}}</td> | |
<td>{{model.notes}}</td> | |
<td>{{formatted-date model.createdAt 'LL'}}</td> | |
<td> | |
{{#if model.isSaving}} | |
Saving .. | |
{{else}} | |
{{view 'select' content=states selection=model.state}} | |
{{/if}} | |
</td> | |
</tr> | |
{{/each}} | |
</tbody> | |
</table> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment