Skip to content

Instantly share code, notes, and snippets.

@frankV
Created July 3, 2013 17:04
Show Gist options
  • Save frankV/5920541 to your computer and use it in GitHub Desktop.
Save frankV/5920541 to your computer and use it in GitHub Desktop.
/*global Todos Ember */
'use strict';
Todos.EditTodoView = Ember.TextField.extend({
classNames: ['edit'],
valueBinding: 'todo.title',
change: function () {
var value = this.get('value');
if (Ember.isEmpty(value)) {
this.get('controller').removeTodo();
}
},
focusOut: function () {
this.set('controller.isEditing', false);
},
insertNewline: function () {
this.set('controller.isEditing', false);
},
didInsertElement: function () {
this.$().focus();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment